Archive for category PowerShell
PowerShell Version 3 if..else bug
Posted by Karl Mitschke in Bug, V3 on August 21, 2012
Consider the following from PowerShell’s excellent help: Get-Help about_If 001002003004005006007008 if ($a -gt 2) { Write-Host “The value $a is greater than 2.”}else{ Write-Host “The value $a is less than or equal to 2, is not created or is not initialized.” } If you modify that example to tighten it up a bit, and make it look better you can cause the […]
Quick modification of the Compare-Command.ps1 script
Posted by Karl Mitschke in Uncategorized, V2, V3 on August 8, 2012
I found a few issues with my Compare-Command script, and have resolved them. If you have already downloaded it from TechNet, thanks, and you can just modify the following two lines: Line 72 becomes:$V3Detailed |select -ExpandProperty Parameters |ForEach-Object -Process {$V3Paramaters += (“$($_.Name)=$($_.ParameterType.name)=$($V3ModuleName[0])“)} Line 82, likewise, becomes:$V2Detailed |select -ExpandProperty Parameters |ForEach-Object -Process {$V2Paramaters += (“$($_.Name)=$($_.ParameterType.Split(“.”)[-1])=$($V2ModuleName[0]))”)} While […]
Quickly compare PowerShell V2 and V3 cmdlets
Posted by Karl Mitschke in V2, V3 on August 7, 2012
Recently, I was looking for the difference between the Get-ChildItem cmdlet in Version 2 and Version 3 of Windows PowerShell. Although you can Bing “PowerShell Get-ChildItem v3” and get an accurate listing of the new parameters from TechNet, that’s not true for all cmdlets, so I wrote a quick little script to find the information. […]
Got-Bug? Connect it!
Posted by Karl Mitschke in PowerShell, V3 on June 18, 2012
I have been running the various versions of PowerShell 3 since the first Windows 8 developer preview was released, and started using the PowerShell ISE at the same time, as PowerGUI was not compatible with the required .Net 4.0 bits. (That’s since been fixed, and yet I remain with PowerShell ISE). Anyhow, I noticed a […]
PowerShell V3 Console improvement
Posted by Karl Mitschke in V3 on January 6, 2012
This may not seem earth shattering, but it’s major news in my world (I’m a 1 finger typist) In the V3 CTP, you now have the ability to use autocomplete in the console, in the middle of a line without losing the rest of the line. This allows you to do this: Get-Mailbox |Select-Object Name, […]
Print from PowerShell’s Integrated Scripting Environment
Posted by Karl Mitschke in ISE, PowerShell on December 30, 2011
Since I started working with the PowerShell V# CTP, I have been using the ISE instead of PowerGUI’s script editor, as PowerGUI does not yet support .Net version 4, which is required by PowerShell V3. One feature that is missing in the ISE is the ability to print a script. Jeffry Hicks has a solution […]
PowerShell WMI Gather DNS settings for all Servers
Posted by Karl Mitschke in PowerShell, V2, WMI on December 23, 2011
A question came up on TechNet: “I am new to PowerShell and need a wmi script to query all the servers on my network for there dns settings and dump it out to a text file. Would someone be able to help me get started?” This was a fairly long script, so I decided to […]
PowerShell V.Next: Simplified Where-Object and ForEach-Object
Posted by Karl Mitschke in V3 on December 20, 2011
I was perusing the samples that come with the PowerShell V3 CTP (Samples\WindowsPowerShell) when I noticed a folder called “Simplified Foreach and Where” Lo and behold, you no longer need curly braces “{}” or the $_ to refer to the current object in the ForEach-Object and Where-Object cmdlets! The sample is incredibly simple, but quickly […]
PowerShell V 3.0 CTP Export-Csv now has an Append parameter!
Posted by Karl Mitschke in V3 on December 16, 2011
Great news for all those folks who rely on Export-Csv and who have been wanting an Append parameter! The latest CTP of PowerShell 3.0 now provides the parameter. It’s not perfect, but it’s close – if the data you are exporting does not match the current data, you will receive an error: If you rerun […]
Windows 8 / PowerShell 3.0 / Microsoft Exchange 2010
Posted by Karl Mitschke in 2010, V3 on September 26, 2011
This is based on the developer’s preview of Windows 8. I will use the tag “Windows 8 Developer Build” for all of these posts. So, I’m playing with Windows 8 and PowerShell version 3, like nearly everyone else on the planet, and decided to install the Exchange Management Tools. The first thing to do is […]