PowerShell 2.0: One Cmdlet at a Time 81 Undo-Transaction

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Undo-Transaction cmdlet. What can I do with it? PowerShell 2.0 introduces new functionality in the form of transactions. By grouping together a set of commands to form a transaction they can either all be committed or all rolled back depending on success. Undo-Transaction rolls back the active transaction. Example: A good example of a possible use for transactions is within the registry.

PowerShell 2.0: One Cmdlet at a Time 80 Get-Transaction

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Transaction cmdlet. What can I do with it? PowerShell 2.0 introduces new functionality in the form of transactions. By grouping together a set of commands to form a transaction they can either all be committed or all rolled back depending on success. Get-Transaction returns an object of a current transaction which has been kicked off with Start-Transaction.

PowerShell 2.0: One Cmdlet at a Time 79 Complete-Transaction

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Complete-Transaction cmdlet. What can I do with it? PowerShell 2.0 introduces new functionality in the form of transactions. By grouping together a set of commands to form a transaction they can either all be committed or all rolled back depending on success. Complete-Transaction commits a transaction which has been kicked off with Start-Transaction.

PowerShell 2.0: One Cmdlet at a Time 78 Start-Transaction

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Start-Transaction cmdlet. What can I do with it? PowerShell 2.0 introduces new functionality in the form of transactions. By grouping together a set of commands to form a transaction they can either all be committed or all rolled back depending on success. Both cmdlets and providers can support transactions, cmdlets will have a UseTransaction parameter.

PowerShell 2.0: One Cmdlet at a Time 77 Remove-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-Computer cmdlet. What can I do with it? Remove the local computer from a workgroup or domain. Example: Remove the local computer from the current domain, then reboot to make the change take effect using the Restart-Computer cmdlet. Remove-Computer ; Restart-Computer How could I have done this in PowerShell 1.0? You could have used the Win32_ComputerSystem WMIClass and the UnjoinDomainorWorkgroup method.

PowerShell 2.0: One Cmdlet at a Time 76 Stop-Computer

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Stop-Computer cmdlet. What can I do with it? Shutdown a local or remote computer Example: Immediately shutdown the computer Server01. Stop-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(5) Alternatively the Systinternals tool PSShutdown could be used to shutdown a local or remote computer.

PowerShell 2.0: One Cmdlet at a Time 75 Remove-Module

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-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. Remove-Module enables you to remove a module previously imported with Import-Module. Example: Check currently available modules with Get-Module and remove the PSDiagnosticsModule. Get-Module Remove-Module PSDiagnostics How could I have done this in PowerShell 1.

Get-Scripting Episode 16 with Hey Scripting Guy Ed Wilson

One of the great things about producing a podcast is that you get to talk to and sometimes meet really interesting people. On the latest epsiode of the Get-Scripting podcast we were lucky enough to talk to Ed Wilson, the Scripting Guy over at Microsoft. I’ve often used and learnt loads from the Hey Scripting Guy series so it was great to talk to the guy who is currently writing them.

PowerShell 2.0: One Cmdlet at a Time 74 Test-ModuleManifest

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Test-ModuleManifest 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. A module creator could use Test-Module to ensure that files listed in a *.psd1 file, possibly created by New-ModuleManifest , are valid. Example: Test that the C:\Users\User1\Documents\WindowsPowerShell\Modules\Logfile-Module\Logfile-Module.psd1 (created in the New-ModuleManifest example) is valid.

PowerShell 2.0: One Cmdlet at a Time 73 New-ModuleManifest

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-ModuleManifest 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. Creators of Modules can use the New-ModuleManifest cmdlet to create a module manifest *.psd1 file which can be used to enhance to processes around a module, such as any prerequisites.