Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

Feb 10, 2016
Post comments count 0
Post likes count 0

Using the PowerShell CIM cmdlets for fun and profit

Doctor Scripto

Summary: Learn how to use CIM cmdlets for better speed, security, and data return as opposed to the WMI cmdlets in Windows PowerShell. The other day, Windows PowerShell MVP, Richard Siddaway, posted Should I use CIM or WMI with Windows PowerShell? Today, I would like to continue that discussion a little bit. You should read Richard’s blog post before you read mine today. In the old days (like way back in Windows PowerShell 1.0), if you wanted to do anything on a remote computer, you were pretty much limited to using WMI—kind of like things were in the VBScript days. Sure, there were some things that you could d...

Feb 9, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to get only the date

Doctor Scripto

Summary: Learn how to find only the date by using the Get-Date cmdlet.  How can I use Windows PowerShell to easily display only the date (not the time)?  Use the Get-Date cmdlet and specify a display hint of date, for example: Get-Date -DisplayHint date

Feb 9, 2016
Post comments count 0
Post likes count 1

PowerTip: Use Get-Command to resolve PowerShell alias

Doctor Scripto

Summary: Learn how to use the Get-Command cmdlet to resolve an alias to a Windows PowerShell command.  How can I find if a Windows PowerShell command is an alias?  Use the Get-Command cmdlet, for example: gcm gwmi Note: gcm is an alias for Get-Command.

Feb 8, 2016
Post comments count 0
Post likes count 0

PowerTip: Find schema of a WMI class

Doctor Scripto

Summary: Learn how use Windows PowerShell to find the schema of a WMI class.  How can I use Windows PowerShell to look at the schema of a WMI class?  Use the Get-CIMClass cmdlet, for example: Get-CimClass win32_bios

Feb 8, 2016
Post comments count 0
Post likes count 0

Should I use CIM or WMI with Windows PowerShell?

Doctor Scripto

Summary: Richard Siddaway explains the differences between the CIM cmdlets and the WMI cmdlets, and details use cases.  Hey, Scripting Guy! Should I use the WMI cmdlets or the newer CIM cmdlets? —NR  Hello NR, Honorary Scripting Guy, Richard Siddaway, here today filling in for my good friend, The Scripting Guy. The simple answer is that you can use either Windows Management Instrumentation (WMI) or Common Information Model (CIM) cmdlets, but there are (to my mind) some significant advantages to using the newer CIM cmdlets. Before I show you why I think you should use the CIM cmdlets, let’s do a little recap....

Feb 7, 2016
Post comments count 0
Post likes count 0

PowerTip: Hide a PowerShell ISE add-on

Doctor Scripto

Summary: Learn how to programmatically hide a Windows PowerShell ISE add-on.  How can I use code to hide one of the Windows PowerShell ISE add-ons?  Use the Windows PowerShell ISE object model, and set the IsVisible property of the add-on to False, for example: $psISE.PowerShellTabs.VerticalAddOnTools.Item(0).isvisible = $false  

Feb 7, 2016
Post comments count 0
Post likes count 0

PowerTip: Display Windows PowerShell ISE add-ons

Doctor Scripto

Summary: Display the Windows PowerShell ISE add-ons that are available.  How can I programmatically display the Windows PowerShell ISE add-ons that are available and show their status?  Use the Windows PowerShell ISE object model to display the VerticalAddonTools collection from the PowerShellTabs collection: $psISE.PowerShellTabs.VerticalAddOnTools

Feb 6, 2016
Post comments count 0
Post likes count 0

PowerTip: List all scripts open in Windows PowerShell ISE

Doctor Scripto

Summary: List all the scripts that are open in the Windows PowerShell ISE.  How can I find which scripts are open in the Windows PowerShell ISE and if they are saved?  Use the ISE object model and display the Files collection from the PowerShellTabs collection: $psISE.PowerShellTabs.Files

Feb 6, 2016
Post comments count 0
Post likes count 0

PowerTip: Open a script in PowerShell ISE

Doctor Scripto

Summary: Automatically open a script in the Windows PowerShell ISE.  How can I automatically open a script in the Windows PowerShell ISE from within a script?  Use the Windows PowerShell ISE automation model, and use the Add method for the Files collection on the current PowerShell tab, for example: $psISE.CurrentPowerShellTab.Files.Add("C:\fso\backup.ps1")