PowerShell Team
Automating the world one-liner at a time…
Latest posts
Best of Tech.Ed 2006 (BOSTON)
TechNet has made the provided videos of the top rated sessions of the TechEd 2006 Boston conference available at: http://www.microsoft.com/emea/itshowtime/ My talk: Windows PowerShell: Next Generation Command Line Scripting is available at: http://www.microsoft.com/emea/itsshowtime/sessionh.aspx?videoid=209 Enjoy! Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectMicrosoft CorporationVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
All crosshairs on the same prairie dog
When I lived in Colorado, I picked up the great concept/phrase, "All crosshairs on the same prairie dog". Damon Cortesi recent blog highlights this principle. http://dcortesi.com/2006/09/07/windows-powershell/ He posted a blog about the verbosity of PowerShell and within an hour - we had 3 PowerShell people post comments. We compared notes and there were no comments when any of us responded so he must have had moderation turned on. Enjoy Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/Power...
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) {[datetime]::Now.Date -eq $date.Date} This takes advantage of 2 things: With this you can do things like: PS> dir > t4.txtPS> dir |where {isToday $_.lastwritetime} Directory: Microsoft.PowerShell.Core\FileSystem::C:\ps Mode &...
BizTalk Server Applications: Get/Start/Stop
Tomas Restrepo has a nice script for getting/starting/stoping BizTalk Server Applications at: http://www.winterdom.com/weblog/2006/09/02/BTSResetWithPowerShell.aspx I like how readable it the script is. It is completely obvious what is going on. Compare that script with his original C# implementation at: http://www.winterdom.com/weblog/2005/07/02/BTSReset.aspx Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scrip...
Tip of the Day
Exchange 2007 has implemented a Get-Tip cmdlet which emits a tip of the day. Flaphead has written a small script which gets them all and has published them on: http://blog.flaphead.dns2go.com/archive/2006/08/17/3514.aspx. There are a number of general tips along with the Exchange tips. Here is an example: Tip of the day #29:Tab completion reduces the number of keystrokes that are required to complete a cmdlet. Just press the TAB key to complete the cmdlet you are typing. Tab completion kicks in whenever there is hyphen (-) in the input. For example: Get-Send<tab> should complete to...
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()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.Ports.SerialPort COM3,9600,None,8,onePS> $port.Open()PS> $port.ReadLine() For information about how to read from a serial port in an asynchronous manner in PowerShell V2, use the DataReceived event on the port object with the Register-ObjectEvent cmdlet. E...
Background "jobs" and PowerShell
A lot of people have asked whegther Windows PowerShell can do UNIX job handling. The paraphrase an old management salesperson joke, "YES - YOU can do UNIX job handling with Windows PowerShell" (which means you have to do it yourself). Jim Truher shows you how in his latest blog entry: http://jtruher.spaces.live.com/PersonalSpace.aspx Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.m...
Automating Dell Battery Replacement Discovery
MOW has done it again. Checkout his blog entry which shows how to leverage Windows PowerShell to automate determining which of the Dell laptops in your enterprise need to have their batteries replaced. http://mow001.blogspot.com/2006/08/powershell-has-my-dell-dangerous.html Totally cool. Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx PSMDTAG:WMI:win32_battery PSMDTAG:FAQ: H...
PowerShell Namespsaces
A summary of the Namespaces PowerShell defines and uses. System.Management.Automation System.Management.Automation serves as the root namespace for PowerShell. The namespace contains the types a developer would use to implement a Cmdlet. Sub-namespaces are defined for specific sections of the API that are used by specific types of developers. System.Management.Automation.Host System.Management.Automation.Host contains the types a developer would use to interact with the Host. The Host manages user interactions and creates the Runspace(s) in which scripts are executed. ...