This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== PowerShell Direct (Guest Scripting) ====== ===== Command Invokation ===== <codeprism lang="ps1"> Invoke-Command -VMName <VM> -Credential (Get-Credential) -ScriptBlock { <Any PowerShell commands to run inside the VM> } </codeprism> ===== File Transfer to VM===== <code powershell> # Open a PSSession to the Virtual Machine $Session = New-PSSession -VMName <VM> -Credential (Get-Credential) # Copy the File to the Virtual Machine Copy-Item -ToSession $Session -Path <SourcePath> -Destination <DestinationPath> # Close the PSSession Remove-PSSession -Session $Session </code> ===== File Transfer from VM===== <code powershell> # Open a PSSession to the Virtual Machine $Session = New-PSSession -VMName <VM> -Credential (Get-Credential) # Copy the File from the Virtual Machine Copy-Item -FromSession $Session -Path <SourcePath> -Destination <DestinationPath> # Close the PSSession Remove-PSSession -Session $Session </code>