One of the best books I purchased when I was first learning PowerShell was Windows PowerShell v.1 TFM from Sapien Press by Don Jones and Jeff Hicks. It was great for making that jump from initial exposure to PowerShell to firming up fundamentals and being confident in writing your own scripts.
They have recently released an updated version to cover PowerShell 2.0, but as a great gesture have released the original version as a free e-book download.
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
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.
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.
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.
After my PowerCLI session at yesterday’s London VMUG a few people asked me for the content. I believe the content from all sessions will soon be posted to http://www.box.net/londonug, but in the meantime you can get my slides from the below link.
PowerCLI Workshop London VMUG.pptx
Thanks to all who chatted to me afterwards, its always nice to know that someone got something out of a session you put on.
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.
I recieved a preview copy of the vSphere 4.0 Quick Start Guide a few weeks back from my good friend and PowerCLI expert Alan Renouf . It is a great read and because of its size is really handy fo carrying around and referring to without needing to lug a 700 page book around with you. (Having said that I do currently have Scott Lowe’s Mastering vSphere in my bag at the moment!
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)
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.