Hi,
i have some Windows-Guests residing in a huge Cluster. These VM´s should be migrated from SAN to NFS, but we have to ensure, that only VM´s with an Disk-Offset ( Diskpart ) divisible by 4 ( named " aligned" ) are migrated.
So i need a Report to see, which VM´s ( Guests ) are already aligned ( so i only have to do a StoragevMotion) and which are not...
If i do it manually, it will take hours to check every VM, but it will work like this:
logon to the VM, start diskpart -> sel disk 0 -> list part ->decision by output-value " offset"
Any idea?
Thx in advance
Chakoe
strange....seems to be working on an XP SP2 32-Bit 🙂
but:
the client i have to use to run the script is in another domain than some of our ( virtual ) servers....is it possible to provide some credentials
( or a credential-file which contains my user-name and password ) ?
Try running the script from a 32-bit session on the W2K8 server.
If you mean the Get-WmiObject cmdlet, you can use the Credentials parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good morning,
my script ( running on my XP 32-Bit SP2 ) actually looks like:
###############
$credential = Get-Credential myDom\UserAcc
################
But now I´, getting the following error on every VM ( the provided Credential has local Admin-rights on the target VM´s )
I got it!!
Set-PowerCLIConfiguration -DefaultVIServerMode single -ProxyPolicy NoProxy -Confirm:$false Set-PowerCLIConfiguration -ProxyPolicy NoProxy -Confirm:$false clear Write-Host "################################" Get-Cluster D100CP05 | Get-VM * | Sort-Object $_.Name | where {(Get-Datastore -VM $_).Type -eq "VMFS" -and $_.Guest.State -eq "Running" -and $_.Guest.GuestId -match "win" -and $_.Name -match "SRVM" } | %{ $temp = $_.Guest.Hostname $offset_d0p0 = Get-WmiObject Win32_DiskPartition -ComputerName $temp | where {$_.Name -eq "Datenträger Nr. 0, Partition Nr. 0" } | Select Startingoffset $offset_d1p0 = Get-WmiObject Win32_DiskPartition -ComputerName $temp | where {$_.Name -eq "Datenträger Nr. 1, Partition Nr. 0" } | Select Startingoffset $offset_d2p0 = Get-WmiObject Win32_DiskPartition -ComputerName $temp | where {$_.Name -eq "Datenträger Nr. 2, Partition Nr. 0" } | Select Startingoffset $offset_d3p0 = Get-WmiObject Win32_DiskPartition -ComputerName $temp | where {$_.Name -eq "Datenträger Nr. 3, Partition Nr. 0" } | Select Startingoffset if ($offset_d0p0.Startingoffset -eq "32256") { Write-Host $temp "Disk:0 Part:0 ist 32KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d0p0.Startingoffset -eq "1048576") { Write-Host $temp "Disk:0 Part:0 ist 1024KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d0p0.Startingoffset -eq "8225280") { Write-Host $temp "Disk:0 Part:0 ist 8033KB aligned, NICHT OK ! " -BackgroundColor Black -ForegroundColor Red } if ($offset_d1p0.Startingoffset -eq "32256") { Write-Host $temp "Disk:1 Part:0 ist 32KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d1p0.Startingoffset -eq "1048576") { Write-Host $temp "Disk:1 Part:0 ist 1024KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d1p0.Startingoffset -eq "8225280") { Write-Host $temp "Disk:1 Part:0 ist 8033KB aligned, NICHT OK ! " -BackgroundColor Black -ForegroundColor Red } if ($offset_d2p0.Startingoffset -eq "32256") { Write-Host $temp "Disk:2 Part:0 ist 32KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d2p0.Startingoffset -eq "1048576") { Write-Host $temp "Disk:2 Part:0 ist 1024KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d2p0.Startingoffset -eq "8225280") { Write-Host $temp "Disk:2 Part:0 ist 8033KB aligned, NICHT OK ! " -BackgroundColor Black -ForegroundColor Red } if ($offset_d3p0.Startingoffset -eq "32256") { Write-Host $temp "Disk:3 Part:0 ist 32KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d3p0.Startingoffset -eq "1048576") { Write-Host $temp "Disk:3 Part:0 ist 1024KB aligned. Alinging OK ! " -BackgroundColor Black -ForegroundColor Green } if ($offset_d3p0.Startingoffset -eq "8225280") { Write-Host $temp "Disk:3 Part:0 ist 8033KB aligned, NICHT OK ! " -BackgroundColor Black -ForegroundColor Red } Write-Host "################################" }
Now i only have to check why I´m getting an RPC-Error on some VM´s ( RPC-Server not avaiable ), there might be Problem with the firewalls...
So:
the acutal error is:
Even if i provide the Credentials ( $credential = Get-Credential ..... ) and then use the $credential in the Get-WmiObject.....
Doesn´t matter if i provide an local-admin-account for the target VM´s or if i use a Domain-Admin-User...
is there another special way to configure the authentication?