Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Invoke-Command for Export-VM

$
0
0

I am implementing a low budget backup scheme for our Windows 2012 R2 HyperV environment. I want to do an Export-VM on a VM and save it to a NAS box. However, the NAS box only allows actual Active Directory usernames to write to the disk. The Export-VM cmdlet runs under the machine account that HyperV uses, so I cannot export directly from the HyperV server to the NAS box.

Instead, I do an Export-VM to a network share, then move that folder to the NAS box.

To automate this, I want to run a Powershell script on the file server, but its only running Windows 2008 R2 and thus cannot manage a Windows 2012 R2 HyperV server.

So, I tried using:

Text
 Invoke-Command -computername HyperVHost -Scriptblock { Export-VM -Name VM1 -Path \\Fileserver\Archive } 
Now, the Export-VM portion of the code works without a problem on the HyperVHost. I did have...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images