PowerShell Team
Automating the world one-liner at a time…
Latest posts
Test-Path: We Goofed
Test-Path: We Goofed! (also known as a documentation errata…) Test-Path is a very handy little cmdlet. You submit a path and it tells you (TRUE/FALSE) whether the elements of the path exist on the computer. You can use it to determine whether particular files or folders are present (or missing) or to look for a registry key that indicates that a program is installed, among so many other uses. My favorite Test-Path command reminds me when I've forgotten to copy my Windows PowerShell profile to one of my test machines (test-path $profile). Test-Path is so good that there was no need to exaggerate its abilities i...
Windows Server 2003 SP2 upgrade
Because of the nature of the Windows Service pack (SP) releases, all the windows updates are consumed by SP upgrade. So once you upgrade to a new SP all the updates that were installed earlier cannot be uninstalled. Since Windows PowerShell is released as an update to Windows, upgrading to W2k3 SP2 will remove the powershell uninstaller and you cannot uninstall PowerShell directly. Windows update technology do not support out of order uninstalls ie., 1. Install Update A + Install Update B + Install Update C. 2. To uninstall Update A, the supporte...
Monad Manifesto – the Origin of Windows PowerShell
Attached is a public version of the original Monad Manifesto. This is not a Windows PowerShell whitepaper nor is it an accurate description of how V1.0 works. This is a version of the original Monad Manifesto which articulated the long term vision and started the development effort which became PowerShell. Many of the elements described in this document have been delivered and those that have not provide a good roadmap for the future. The document has been updated for publication. Confidential information has been culled and examples are updated to reflect the current syntax. Enjoy! Jeffrey Snover [MSFT]...
PowerShell Webcasts available
Don Jones is doing a series of PowerShell WebCasts over at Microsoft.com. There are the one coming up: You can get more information about this series including links to previously recorded webcasts HERE. Enjoy! Jeffrey Snover [MSFT]Management Partner 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
Installing PowerShell on Vista/"Longhorn" Server
1. I am new to PowerShell and would like to install it on my Vista machine. The following page http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx gives you links to various PowerShell downloads. Choose the one that best matches your operating system, platform and language requirements. 2. I am using a “Longhorn” build greater than 5600 and I do not find an installable for my version of “Longhorn” server We currently support Windows PowerShell RC2 for “Longhorn” IDS (5600). This means that you wil...
Detecting Conflicts between Aliases, Functions, and Cmdlets
Version 1.1 of the PowerShell Community Extensions has just been release so I decided to kick the tires. After I installed it, I noticed that some conflicts and then realized that there might be conflicts between my customizations and the Aliases, Functions and Cmdlets that they delivered. Here is how I detected what needed to be resolved: PS> gcm -type cmdlet,function,alias |group name |where {$_.count -gt 1}Count Name Group----- ---- ----- 2 Get-FileVersionInfo {Get-FileVersionInfo, Get-FileVersionInfo} 2 help {help, help} 2 man ...
Scripting Pro VIP Interview
Scott Ottaway and I recently did an interview with Karen Bemowski. You can read it here. Jeffrey Snover [MSFT]Windows PowerShell/MMC 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
Why Can’t I Pipe Format-Table to Export-Csv (and get something useful)?
Ken's PowerShell blog has an entry Remote Services and PowerShell where he wrote a function to get services from a remote machine using WMI. He formatted the data using FT (format-table) and then went on to export the data to CSV. He pointed out that the following would NOT work rget-service remotemachinename netlogon | ft -autosize name,startmode,state,status,startname | export-csv services.csv Instead you should use: rget-service remotemachinename netlogon | Select-Object name,startmode,state,status,startname | export-csv services.csv Let's take a minute to explore why the first command does not work. Let's ...
Invoke-Expression
I fixed a bug in Start-Demo (Script attached) that is worth exploring. The heart of Start-Demo is to get a line from file, display it and then run it showing the output. To do this I used Invoke-Expression (For simplicity sakes, I'm going to show you the code assuming that the line to execute is $LINE – the actual code is a bit more complicated) Invoke-Expression $($LINE + " | out-host") We want to run the command and pipe it's results to out-host. This "mostly" works. I noticed the failure as I started to do more complicated demos. I particular, I wanted to execute the following 2 lines: $y = Get-Process$y |...