cmdlet-series

PowerShell 2.0: One Cmdlet at a Time 8 Get-Module

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Module cmdlet. What can I do with it? PowerShell 2.0 introduces the concept of modules; essentially they are the evolution of snapins from PowerShell 1.0. There are some great videos below by Bruce Payette and Osama Sajid from the PowerShell team both introducing and demonstrating how to use modules: (Thanks Shay) Episode one introduces Modules and discusses comparisons with CmdLets.

PowerShell 2.0: One Cmdlet at a Time 7 Reset-ComputerMachinePassword

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Reset-ComputerMachinePassword cmdlet. What can I do with it? Reset the computer account password for a machine. Examples: Reset the computer account password for the current local machine. It’s as simple as that! Reset-ComputerMachinePassword To do the same for a remote machine you will need to use Invoke-Command to run the command on the remote machine.

PowerShell 2.0: One Cmdlet at a Time 6 Test-Connection

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Test-Connection cmdlet. What can I do with it? Send a ping to one or more computers Examples: Send a ping to Server01 Test-Connection -ComputerName Server01 If the result of a ping to Server01 is successful then copy a text file to a file share on that server If (Test-Connection -computername Server01 -quiet) {Copy-Item C:\Document.

PowerShell 2.0: One Cmdlet at a Time 5 Get-Hotfix

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Hotfix cmdlet. What can I do with it? Retrieve hotfixes installed on a local or remote computer Example: Retrieve a list of hotfixes installed on Server1 which contain Security in their description. Display the Description, HotfixID and Caption properties. Get-Hotfix -description Security* -computername Server01 | Select-Object Description,HotfixID,Caption How could I have done this in PowerShell 1.

PowerShell 2.0: One Cmdlet at a Time 4 Out-GridView

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Out-GridView cmdlet. What can I do with it? View the output from a command in an interactive grid window. Any special requirements? Whilst PowerShell 2.0 itself requires .NET Framework 2.0 with Service Pack 1, this particular cmdlet requires .NET Framework 3.5 Service Pack 1. Examples: Create an interactive grid view of the list of services running on the machine.

PowerShell 2.0: One Cmdlet at a Time 3 Get-Counter

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Counter cmdlet. What can I do with it? Collect real-time performance counter data directly from local or remote computers. Examples: Create a list of performance counters available to query in the Memory counter (Get-Counter -listset memory).paths Tip: To find a list of available top-level counters for which you could substitute in for memory in the above example you could type this set of commands:

PowerShell 2.0: One Cmdlet at a Time 2 Send-MailMessage

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Send-MailMessage cmdlet. What can I do with it? Send an email message using a specific SMTP server, from within a script or at the commaned line. Example: Send-MailMessage -to “Joe Bloggs [email protected]” -from “Jane Smith [email protected]” -subject “Reporting Document” -body “Here’s the document you wanted” -Attachment “C:\Report.doc” -smtpServer smtp.test.local How could I have done this in PowerShell 1.

PowerShell 2.0: One Cmdlet at a Time 1 Get-Random

This is the first of a series looking at new cmdlets available in PowerShell 2.0. We begin by looking at the Get-Random cmdlet. What can I do with it? With Get-Random you can either generate a random number, or randomly select objects from a collection. Examples: Generate a random number between 1 and 100. Get-Random -Minimum 1 -Maximum 101 Select a random object from a collection $users = ‘Rod’,‘Jane’,‘Freddy’ Get-Random $users