Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Get all the virtual machines from hyperV
- #And store them into an object
- $virt_mach = Get-VM
- #Try with one specific VM
- #..You need to start it before
- Start-VM -VM $virt_mach[0]
- #To Access to a specific Vm with credentials
- #You need ti define credentials like this (or with the get-credentials cmdlet)
- $user = "DOMAINmyuser1"
- $password = ConvertTo-SecureString "SuperPasswordSoHaRdToFIND" -AsPlainText -Force
- $creds = New-Object System.Management.Automation.PSCredential ($user,$password)
- #connect to the first VM of the list
- Enter-PSSession -VMName $virt_mach[0].Name -Credential $creds
- #and then write commandy you need to into the virtual machine
- #in here..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement