Invoke-VMShutdown issues

Jun 24, 2011 at 5:12 PM

I found some issues with Invoke-VMShutdown:

-Wai  is not a valid argument, even though it is documented a in help

- ShutdownTimeOut is missing in help

- ShutdownTimeOut is not working, I believe because the variable is miss-spelled:

Function Invoke-VMShutdown
{# .ExternalHelp  MAML-VM.XML
   [CmdletBinding(SupportsShouldProcess=$True , ConfirmImpact='High' )]
    Param(
        [parameter(Mandatory = $true, ValueFromPipeline = $true)]
        $VM,
       
        [parameter()][ValidateNotNullOrEmpty()]
        [string]$Reason = "Scripted",
       
        [parameter()][ValidateNotNullOrEmpty()]
        $Server = ".",   #May need to look for VM(s) on Multiple servers

        [int]$ShutdownTimeOut ,
         
        $PSC,
        [switch]$Force
    )
    process {
        if ($psc -eq $null)  {$psc = $pscmdlet} ; if (-not $PSBoundParameters.psc) {$PSBoundParameters.add("psc",$psc)}
        if ($VM -is [String]) { $VM = Get-VM -Name $VM -Server $Server }
        if ($VM.count -gt 1 ) {[Void]$PSBoundParameters.Remove("VM") ;  $VM | ForEach-object {Invoke-VMShutdown -VM $_  @PSBoundParameters}}
        if ($vm.__CLASS -eq 'Msvm_ComputerSystem')     {
            $Endtime=(get-date).addSeconds($TimeOut)

Regards, Gianni