Powershell or PowerCLI modules for VMware administration/troubleshooting tasks
mathieubuisson / powershell-vmware Goto Github PK
View Code? Open in Web Editor NEWPowershell or PowerCLI modules for VMware administration/troubleshooting tasks
Powershell or PowerCLI modules for VMware administration/troubleshooting tasks
On line 102 of Get-StoreageViewsReport, you run this if statement:
If(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue)) {
Add-PSSnapin VMware.VimAutomation.Core }
For some reason, at least on machines in my environment, this snapin doesn't show as loaded, but when attempting to load it, an error is reported, stating that "an item with the same key has already been added."
The snapins that are loaded for me are
Microsoft.PowerShell.Core
VMware.VimAutomation.License
VMware.DeployAutomation
VMware.ImageBuilder
On line 89 of Get-StorageViewsReport.psm1, you give the variable $Datastore a type of
[VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl[]]
For vmWare configurations where the type NasDatastoreImpl is also used, your code fails.
If you don't explicitly declare the type of this variable, the code works for both types.
Hello M BUISSON,
First excuse for my English i m french.
I'm using your script Get-StorageViewsReport.psm1 to getting a snapshot state for every VM in our VCENTER and we send the result by mail.
All is working fine since several years and i must thanks you for you work and sharing you knowledge.
The problem is that we have create a new DATA CENTER in our VCENTER console with a new CLUSTER inside.
And now the script you developped is no more working
. I try to find why but my knowledge are limited
below the command that we use and that was working fine before creating the 2de Datacenter/cluster
#collect vm snaphot info to text file verifsnapshot.txt
Get-VM | Get-StorageViewsReport | Sort-Object -Property VM | Format-Table -auto | out-file C:\Users\administrateur\Desktop\snapshot_report\verifsnaphot.txt -encoding UTF8 -width 100
The error is probably a problem with the datastore Type (NAS -NFS simplivity) for the second cluster we have created
thanks if you could have time to see why you script is no more working with this new Datastore in NAS type
(I have tested the last version of your script after you patched it for NAS support but it dontt work too)
Thanks
Finally when i suppress the code below (by datastore option) because i d'ont use it i use by-vm (get-vm)
it works.
old version script** don't works like say drockwood94 22 jull 2015 in old comment
**[Parameter(ParameterSetName='ByDatastore')]
[switch]$ByDatastore,
[Parameter(ValueFromPipeline = $True,
ParameterSetName='ByDatastore',
ValueFromPipelineByPropertyName=$True,Position=0)]
[VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl[]]$Datastore = (Get-Datastore),**
******** in your patched code i have to suppress this code below too**** to works
[Parameter(ParameterSetName='ByDatastore')]
84 [switch]$ByDatastore,
85
86 [Parameter(ValueFromPipeline = $True,
87 ParameterSetName='ByDatastore',
88 ValueFromPipelineByPropertyName=$True,Position=0)]
89 [ValidateScript({ $[0] -is [VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl] -or $[0] -is [VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl] })]
90 $Datastore = (Get-Datastore),
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.