Hi,
i try the following script to delete and create snapshots......
#VMware PowerCLI Modul Import
Import-Module VMware.PowerCLI
#Verbindung zum vCenter
Connect-VIServer -Server vcentername
#Löschen aller Snapshots mit dem Namen "Automatische Snapshot..."
Get-VM | Get-Snapshot | where {$_.name -like "Automatische Snapshot Sicherung Testumgebung (24h)"}| Remove-Snapshot -Confirm:$false
#Erstellen neuer Snapshots mit dem Namen "Automatische Snapshot..."
Get-VM -Location "Testumgebung" | New-Snapshot -Name "Automatische Snapshot Sicherung Testumgebung (24h)"
#Verbindung zum vCenter trennen
Disconnect-VIServer -Confirm:$false
But i get this error:
PS C:\Skripte> Get-VM | Get-Snapshot | where {$_.name -like "Automatische Snapshot Sicherung Testumgebung (24h)"}| Remove-Snapshot -Confirm:$false
Remove-Snapshot : 24.06.2021 14:29:15 Remove-Snapshot Ein Aufrufziel hat einen Ausnahmefehler verursacht.
In Zeile:1 Zeichen:101
+ ... pshot Sicherung Testumgebung (24h)"}| Remove-Snapshot -Confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-Snapshot], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveSnapshot
I use vsphere 7.x
Can someone tell me why i get this error?
Regards
Dennis
It looks like you have a mix of 6 and 12.3, that will not work
You should clean up (delete all those folders and then install again).
But that process is described in the posts I linked to earlier.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Which PowerShell version?
From which platform?
Which PowerCLI version?
Do you get the same exception when the Culture is set to en-US?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
PS 5.1.14393.3866 from a Microsoft Server 2016.
PowerCli 6.0 Rel. 1 build 2548067
That is a very old PowerCLI version.
Can you upgrade?
Do you get the same from all platforms where you run this?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I try this:
Install-Module -Name VMware.PowerCLI
But nothing happend.
How can i upgrade my powercli?
Have a look at Welcome PowerCLI to the PowerShell Gallery – Install Process Updates and Updating PowerCLI through the PowerShell Gallery
But also be aware that there are known issues with PowerCLI when the Culture is not en-US.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks.....
Sorry, i think V. 12.3.0 is installed.
That is the version from the Gallery.
You would need to do
Get-Module -Name VMware* -ListAvailable
to see what you have installed on your station.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It looks like you have a mix of 6 and 12.3, that will not work
You should clean up (delete all those folders and then install again).
But that process is described in the posts I linked to earlier.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have removed the old one and installed the new powercli.
Now it works fine.....
Thanks a lot.