====== PowerShell Direct (Guest Scripting) ======
===== Command Invokation =====
Invoke-Command -VMName -Credential (Get-Credential) -ScriptBlock {
}
===== File Transfer to VM=====
# Open a PSSession to the Virtual Machine
$Session = New-PSSession -VMName -Credential (Get-Credential)
# Copy the File to the Virtual Machine
Copy-Item -ToSession $Session -Path -Destination
# Close the PSSession
Remove-PSSession -Session $Session
===== File Transfer from VM=====
# Open a PSSession to the Virtual Machine
$Session = New-PSSession -VMName -Credential (Get-Credential)
# Copy the File from the Virtual Machine
Copy-Item -FromSession $Session -Path -Destination
# Close the PSSession
Remove-PSSession -Session $Session