powershell

PowerShell 2.0: One Cmdlet at a Time 11 Add-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Add-Computer cmdlet. What can I do with it? Join a local computer to a domain or workgroup Example: Join the current computer to the Test domain, place the computer account in the Servers OU and use the Restart-Computer cmdlet to reboot the computer to complete the process. Add-Computer -domainname Test -OUPath ‘OU=Servers,DC=test,DC=local’; Restart-Computer

PowerShell 2.0: One Cmdlet at a Time 10 Restart-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Restart-Computer cmdlet. What can I do with it? Restart a local or remote computer Example: Immediately restart the computer Server01. Restart-Computer -ComputerName Server01 -Force How could I have done this in PowerShell 1.0? You could have used the Win32_OperatingSystem WMI Class and the Win32Shutdown method. (Get-WmiObject -Class Win32_OperatingSystem -ComputerName Server01).Win32Shutdown(2) Alternatively the Systinternals tool PSShutdown could be used to restart a local or remote computer.

PowerShell 2.0 - Where can I find it?

I’ve been fielding a number of queries from colleagues and geek friends about the recently released PowerShell 2.0 and one of the recurring themes seems to be “I’ve searched for PowerShell 2.0, but I’m having trouble finding it…..” As Jakul writes over on his blog this seems to be for a couple of reasons: A lot of people wrote a lot of blogposts about PowerShell 2.0 during its various CTP phases and searches for PowerShell 2.

PowerShell 2.0: One Cmdlet at a Time 9 Checkpoint-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Checkpoint-Computer cmdlet. What can I do with it? Create a system restore point on XP or Vista systems. Example: Create a system restore point called Pre-RegistryChange Checkpoint-Computer -description “Pre-RegistryChange” How could I have done this in PowerShell 1.0? You could have used the SystemRestore WMI class and the CreateRestorePoint method $SystemRestore = [wmiclass]"\\.\root\default:systemrestore" $SystemRestore.

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.

"cd AD:" = wow!

So I had a new article published over at Simple-Talk, Active Directory Management with PowerShell in Windows Server 2008 R2, looking at how you can use the new AD cmdlets and provider to manage Active Directory. Mr Anonymous (it wasn’t me) has already posted a very nice comment which sums up part of the new management experience; “cd AD:” = wow! (OK I know you could do this already with the PowerShell community extensions, so it might not be wow for everybody)

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.