Hello!
I have a powershell script for VMware. It counts all my snapshots.
Script:
Import-Module VMware.VimAutomation.Core >$Null Connect-VIServer 10.20.30.40 -user [email protected] -password "XXXXXXXXXX" >$Null $snapshots_count = 0 get-vm -location esx-cluster | get-snapshot | ForEach-Object {$snapshots_count ++} Disconnect-VIServer -Confirm:$false write-host "<prtg>" write-host "<result>" write-host "<channel>Anzahl Snapshots</channel>" write-host "<value>$($snapshots_count)</value>" write-host "<LimitMaxError>0</LimitMaxError>" write-host "<LimitMode>1</LimitMode>" write-host "</result>" write-host "</prtg>"
When I run the script in the Powershell i get his result:
<prtg> <result> <channel>Anzahl Snapshots</channel> <value>2</value> <LimitMaxError>0</LimitMaxError> <LimitMode>1</LimitMode> </result> </prtg>
But PRTG shows always 0 and not 2 (the real value).
When I change "$snapshots_count = 0" in the script PRTG will show my the chanded value. For example:
$snapshots_count = 5 -> PRGT shows 5
What I'm doing wrong?
Add comment