Check that file within comments system partitions are correctly aligned

An attempt to follow the best practices of VMware, I am creating a script via powerCLI that will tell me whether or not the system partitions are aligned. I realize that, for 2008, and the systems operating newer, partitions are automatically aligned, however for the old servers I would check and make sure that they are also well aligned. I wrote the script following, but for some reason, it does not:

$vms = get - vm | where {$_.} PowerState - eq "Receptor" - and $_. {Guest.OSFullName - match "Microsoft Windows *"} | name sort

{foreach ($vm to $vms)

$wmi = get-wmiobject-class "win32_DiskPartition" - namespace "root\CIMV2" ComputerName - $vm

$wmi | Select Name, NumberofBlocks, Startingoffset

#Alignment = Startingoffset / blocksize

$blocksize = $wmi | Select the block size

$startingoffset = $wmi | Select startingoffset

$Alignment = $startingoffset / $blocksize

}

I'm doing this code, check partitions for each virtual machine in my environment and export to a spreadsheet data it obtains. No matter who would be able to help me to get this script working properly?

Try something like this

$vms = Get-VM |   where {$_.PowerState -eq "PoweredOn" -and $_.Guest.OSFullName -match "Microsoft Windows*" } |   Sort-Object -Property Name$Report = @()foreach($vm in $vms){  Get-WmiObject -Class "win32_DiskPartition" -Namespace "root\CIMV2" -ComputerName $vm | %{    $row = "" | Select VM, Partition, NumberofBlocks, Blocksize, Startingoffset, Alignment    $row.VM = $vm.Name    $row.Partition = $_.Name    $row.NumberofBlocks = $_.NumberofBlocks    $row.Blocksize = $_.blocksize    $row.Startingoffset = $_.startingoffset    $row.Alignment = $row.startingoffset / $row.blocksize

    $Report += $row  }}$Report | Export-Csv report.csv -NoTypeInformation -UseCulture

Tags: VMware

Similar Questions

Maybe you are looking for

  • IPod reads no. music

    Hello! ITunes froze when synchronization/trying to add songs on my iPod Classic. And then the Finder froze while I tried this way eject it. I found myself having to just disconnect. Now my iPod reads without music! Argh. I accidentally unplugged the

  • How can I download Youtube videos on my mac? Real used to work and it does not longer.

    I can't download YouTube more. I have FF 20.0 and use mac os x 10.8. Real used to work, but no more.

  • Extreme Seting

    I have a time capsule as the main, extreme router as an extension of another wifi extend, but there are two new Express extended to the extreme, worked well, two days before the discovery of wifi slow down, after the discovery of two Express is not e

  • Installation of an optical disc (SD-2212) in a Satellite 1900 305 drive

    The SD-2212 drive in my laptop failed. I bought an identical car, turned off the laptop, installed the new drive, back running the laptop and the drive is not found. I took the drive and replaced an old and preformed a restore of the system without r

  • Scanner is not able to scan a page in pdf format

    I JUST BOUGHT HP 2515 PRINTER ink advantage ALL IN ONE. I LOOK to find out why my scanner fails to scan a page to pdf file, even if the options are to come, but after saving I m get a white page