Showing results for DOTNET - PowerShell Team

Sep 17, 2006
0
0

Useful DateTime functions – LibraryTime.ps1

PowerShell Team
PowerShell Team

I was going to post a blog entries and realized that the example I wanted to give used some of my utility functions so I'll share them first.  I hope you find them interesting.  I put them in a file called LibraryTime.ps1 and dot source that during my login.  BTW  - everyone should adopt that pattern.  Files that contain ...

DOTNETMeasure-SinceMeasure-Till
Sep 17, 2006
0
0

The Wonders of Date Math using Windows PowerShell

PowerShell Team
PowerShell Team

Larry Hayden posted a query about dates at:http://techtasks.com/bookmarks/powershell/2006/09/interview-with-a-scripter-jeffrey-snover/ He has a script which gets all the Application Events that happened TODAY: ————————————————————$today = [DateTime]::Today$Events = Get-Eventlog -New 1024 Application | Where...

FAQDOTNET
Aug 31, 2006
0
0

Writing and Reading info from Serial Ports

PowerShell Team
PowerShell Team

PSMDTAG:FAQ: How do I read/write data from a Serial Port? Writing to a Serial Port PS> [System.IO.Ports.SerialPort]::getportnames()COM3PS> $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,onePS> $port.open()PS> $port.WriteLine("Hello world")PS> $port.Close()Reading from a Serial Port PS> $port= new-Object System.IO....

FAQDOTNETSystem.IO.Ports.SerialPort
Jul 24, 2006
0
0

Casting a scriptblock to an arbitrary delegate signature

PowerShell Team
PowerShell Team

Arild asked the following in http://arildf.spaces.msn.com/blog/cns!E99F8B43533149B0!140.entry?_c%3dBlogPart : PSMDTAG:FAQ: Delegates - how to cast a scriptblock to an arbitrary delegate signature? ANSWER - You can't in V1.0. In version 1.0 Windows PowerShell only supports casting scriptblocks to delegates with the signature: ...

FAQDOTNETScriptBlock
Jul 15, 2006
0
0

Cascading Type Casts

PowerShell Team
PowerShell Team

A user on the newsgroup wondered whether the example below highlighted a bug or a feature.  They applied multiple type declarations on a single parameter and Windows PowerShell did not complain. function check {   param([string] [int] $y = 0, $x = 0)###^^^^^^^^^^^^  $x.GetType().ToString();  $y.GetType().ToString();  $x + $...

FAQDOTNET
Jul 12, 2006
0
0

Type Shortcuts

PowerShell Team
PowerShell Team

PSMDTAG:FAQ: What is a TYPE SHORTCUT?PSMDTAG:FAQ: What are the TYPE SHORTCUTS?   Type shortcuts are a Windows PowerShell feature that allows you to reduce the amount of typing you have to do when specifying a type.    For example, the following 2 statements produce the same result: [System.Text.RegularExpressions.Regex]"^c.*" [Regex...

FAQDOTNETLANGUAGE
Jun 16, 2006
0
0

Using Format Control Strings.

PowerShell Team
PowerShell Team

PSMDTAG:FAQ: How do I display large numbers with commas?PSMDTAG:FAQ: How do I use .NET formatting strings? As scripters, we often spend tons of times trying to get our data formated just the right way.  Often this is an error-prone, frustrating experience.  Windows PowerShell leverages .NET objects to make this task a ton simpler.  ...

FAQDOTNET
Apr 25, 2006
0
0

Exposing the Power of .NET in a Admin-friendly way

PowerShell Team
PowerShell Team

One of our primary goals for Monad was to:  "Expose the power of .NET in an Admin-friendly way".  The challenges of systems administration are large and growing at the same time organizations are under ever more pressure to reduce costs and do more with less.  That was true 10 years ago, it is true now, it will be true 10 years from...

PHILOSOPHYDOTNETINTERNAL
Apr 25, 2006
0
0

Base64 Encode/Decode a string

PowerShell Team
PowerShell Team

Today I came across http://scripts.readify.net/  . This sight is focused on Monad and MSH and is starting a collection of scripts at: http://scripts.readify.net/Scripts.aspx .  You should visit their site and let them know what type of scripts would be useful to you.  I particularly liked their entry on how to Base64 encode a ...

FAQPHILOSOPHYDOTNET
Apr 25, 2006
0
0

Comparative Examples in MSH and KSH

PowerShell Team
PowerShell Team

  Most shells (such as Windows CMD.EXE and the UNIX shells SH, KSH, CSH, and BASH) operate by executing a command or utility in a new process, and presenting the results (or errors) to the user as text. Text-based processing is the way in which system interaction is done with these shells. Over the years, a large number of text processing ...

FAQDOTNETSHELL

Feedback