Nice to know: optimize-vhd in Windows Server 2012
Skriven av
Mikael Nystrom
,
02 August 2012
·
352 visningar
I needed to compress a bunch of VHD’s and of course that means PowerShell so I did a (very simple) script for it. Its easy to use, just remember to set execution policy correctly before you use it otherwise the script does not run. So here it isParam
(
[parameter(mandatory=$true,HelpMessage="Please, Give a folder to start from, ok?")][ValidateNotNullOrEmpty()]$VHDPath,
[parameter(mandatory=$true,HelpMessage="Please, Give the mode, quick or full?")][ValidateNotNullOrEmpty()]$Mode
)
get-childitem $VHDPath -recurse -filter *.vhd | ForEach-Object {optimize-vhd -Path $_.FullName -Mode $Mode}
The script takes to parameters, –VHDPath and –Mode
/mike
http://feeds.wordpress.com/1.0/comments/anothermike2.wordpress.com/551/
Källa
(
[parameter(mandatory=$true,HelpMessage="Please, Give a folder to start from, ok?")][ValidateNotNullOrEmpty()]$VHDPath,
[parameter(mandatory=$true,HelpMessage="Please, Give the mode, quick or full?")][ValidateNotNullOrEmpty()]$Mode
)
get-childitem $VHDPath -recurse -filter *.vhd | ForEach-Object {optimize-vhd -Path $_.FullName -Mode $Mode}
The script takes to parameters, –VHDPath and –Mode
- The VHDPath is the starting point from where to start search for VHD and VHDx files in the form of –VHDPath C:VMs
- The Mode is also simple to use, it takes Full, Quick, Retrim, Pretrimmed and Prezeroed. Now that does require some understanding I believe. So here is the explanation from TechNet:
/mike
http://feeds.wordpress.com/1.0/comments/anothermike2.wordpress.com/551/

Källa




Skapa anpassat tema


