if ( $HOME[0] -eq "/" ) { # Linux shutdown -P } else { # Windows ( Get-WMIObject -Query "Select * From Win32_OperatingSystem Where Primary=True" ).ShutDown( ) }