Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

79 Find VMs in Uncontrolled Snapshot Mode.ps1 #478

Closed
rogersa2k opened this issue Aug 22, 2016 · 4 comments
Closed

79 Find VMs in Uncontrolled Snapshot Mode.ps1 #478

rogersa2k opened this issue Aug 22, 2016 · 4 comments

Comments

@rogersa2k
Copy link

rogersa2k commented Aug 22, 2016

I just upgraded to 6.23 and when I run it I get the following:

[09:44:03] ..start calculating VMs in uncontrolled snapshot mode by Rick Glover, Matthias Koehler, Dan Rowe v1.4 [73 of 84]
Method invocation failed because [System.Management.Automation.PSObject] doesnot contain a method named 'op_Addition'.
At C:\Scripts\vCheck6\vcenter901\Plugins\60 VM\79 Find VMs in Uncontrolled
Snapshot Mode.ps1:9 char:5
+     $fileList += Get-ChildItem -Path "$FilePath" | Select Name, FolderPath,
Full ...
+
+ CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
@rogersa2k
Copy link
Author

Hmm, I can't seem to figure out how to paste the entire error properly but I think you get the point.

@danimalrowe
Copy link
Contributor

Hi rogersa2k,

I think the issue is that the statement prior is not finding any data so $fileList is not defined. Try this

Replace line 9 with the following

if ( $fileList -ne $null ) {
$fileList += Get-ChildItem -Path "$FilePath" | Select Name, FolderPath, FullName
} else {
$fileList = Get-ChildItem -Path "$FilePath" | Select Name, FolderPath, FullName
}

Hopefully this will fix the issue.

@Sneddo
Copy link
Collaborator

Sneddo commented Aug 22, 2016

Yep, I think danimalrowe is right on this one.

We can just cast $filelist as an array as well, which should fix it without additional lines of code.

Sneddo added a commit that referenced this issue Oct 10, 2016
Made sure $fileList is an array, so adding to it won't throw an error.

Updated to use Write-Progress to provide feedback on long-running plugin.
@Sneddo
Copy link
Collaborator

Sneddo commented Oct 10, 2016

Just puushed an update to the dev branch which seems to fix this for me. Let me know if you still have issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants