Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » DOTNET » FAQ   (RSS)

The Wonders of Date Math using Windows PowerShell

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
Posted by PowerShellTeam | 3 Comments
Filed under: ,

DateTime Utility Functions

I often want to find things that happened Today. For instance, which files got changed today. Windows PowerShell makes this easy to do but it can be a bit verbose and I do it a lot so I've added a function to my profile: IsToday. function isToday ([datetime]$date)
Posted by PowerShellTeam | 6 Comments
Filed under: ,

Writing and Reading info from Serial Ports

PSMDTAG:FAQ: How do I read/write data from a Serial Port? Writing to a Serial Port PS> [System.IO.Ports.SerialPort]::getportnames() COM3 PS> $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one PS> $port.open() PS> $port.Write("Hello
Posted by PowerShellTeam | 4 Comments
Filed under: ,

Casting a scriptblock to an arbitrary delegate signature

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
Posted by PowerShellTeam | 3 Comments
Filed under: ,

Attachment(s): h.ps1

Cascading Type Casts

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) ###^^^^^^^^^^^^
Posted by PowerShellTeam | 2 Comments
Filed under: ,

Type Shortcuts

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
Posted by PowerShellTeam | 5 Comments
Filed under: , ,

Using Format Control Strings.

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.
Posted by PowerShellTeam | 3 Comments
Filed under: ,

Base64 Encode/Decode a string

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

Sunday morning drive with my hair on fire: Types/Community/Synthetic types/Democracy/Cool XML tricks

Exploring types is a pain! Monad provides Get-Member which makes it pretty nice to explore an OBJECT but if you want to explore that object's type, you have to use the capabilities of the System.RuntimeType class. Let me make that distinction a little
Posted by PowerShellTeam | 1 Comments
Filed under: , , ,

Comparative Examples in MSH and KSH

M ost 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
Posted by PowerShellTeam | 49 Comments
Filed under: , ,
 
Page view tracker