Hi People,
Can anyone please assist me in finding any .ISO files spread across my datastore with powershell script for both local datastore and SAN ?
Thanks,
AWT
The Format-Table -AutoSize cmdlet only shows output on screen when all objects are received.
It can take very long before you see anything on screen due to the size of your datastores.
Try it this way
dir vmstores:\ -Recurse -Include *.iso | Select Name,FolderPath
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello, AlbertWT-
That is pretty straightfoward, thanks to the PSDrive "vmstores:\" that gets created in your PowerCLI session (specifically, when the VMware.VimAutomation.Core PSSnapin gets added to the session). This PSDrive is created using the VimDatastore provider, and provides access to all of the datastores in all of the VIServers to which you are connected via Connect-VIServer.
So, you can use a "dir" (alias for Get-ChildItem) to find the ISOs that you desire:
dir vmstores:\ -Recurse -Include *iso | ft -a
There are other ways to search datastores, but this should suit the need you mentioned. How does that do for you?
Hi Matt,
It doesn't show up anything ?
I'm using PowerGUI Script Editor with the following configurations:
PS Microsoft.PowerShell.Core\FileSystem::\\FileServer01\homedir\Albert> Get-PowerCLIVersion | ft -AutoSizeMajor Minor Build Revision Copyright Company UserFriendlyVersion SnapinVersions----- ----- ----- -------- --------- ------- ------------------- --------------4 1 332441 0 Copyright © VMware, Inc. 1998-2010 VMware, Inc. VMware vSphere PowerCLI 4.1 U1 build 332441 {VMWare vSphere PowerCLI 4.1 U1 build 332441}PS Microsoft.PowerShell.Core\FileSystem::\\FIleServer01\homedir\Albert> Get-PowerCLIConfiguration | ft -AutoSizeProxy Policy Default Server Mode------------ -------------------UseSystemProxy MultiplePS Microsoft.PowerShell.Core\FileSystem::\\FileServer01\homedir\Albert> Get-PSProvider | ft -AutoSizeName Capabilities Drives---- ------------ ------WSMan Credentials {WSMan}Alias ShouldProcess {Alias}Environment ShouldProcess {Env}FileSystem Filter, ShouldProcess {C, D, G, H...}Function ShouldProcess {Function}Registry ShouldProcess, Transactions {HKLM, HKCU}Variable ShouldProcess {Variable}Certificate ShouldProcess {cert}VimDatastore ShouldProcess {vmstores, vmstore}VimInventory Filter {vis, vi}PS Microsoft.PowerShell.Core\FileSystem::\\FileServer01\homedir\Albert> Get-PSSnapin | ft -AutoSizeName PSVersion Description---- --------- -----------Microsoft.PowerShell.Diagnostics 2.0 This Windows PowerShell snap-in contains Windows Eventing and Performance Counter cmdlets.Microsoft.WSMan.Management 2.0 This Windows PowerShell snap-in contains cmdlets (such as Get-WSManInstance and Set-WSManInstance) that are used by t...Microsoft.PowerShell.Core 2.0 This Windows PowerShell snap-in contains cmdlets used to manage components of Windows PowerShell.Microsoft.PowerShell.Utility 2.0 This Windows PowerShell snap-in contains utility Cmdlets used to manipulate data.Microsoft.PowerShell.Host 2.0 This Windows PowerShell snap-in contains cmdlets (such as Start-Transcript and Stop-Transcript) that are provided for...Microsoft.PowerShell.Management 2.0 This Windows PowerShell snap-in contains management cmdlets used to manage Windows components.Microsoft.PowerShell.Security 2.0 This Windows PowerShell snap-in contains cmdlets to manage Windows PowerShell security.Quest.ActiveRoles.ADManagement 1.0 This Windows PowerShell snap-in contains cmdlets to manage Active Directory and Quest ActiveRoles Server.VMware.VimAutomation.Core 2.0 This Windows PowerShell snap-in contains Windows PowerShell cmdlets for managing vSphere.Microsoft.Exchange.Management.PowerShell.Admin 1.0 Admin Tasks for the Exchange ServerMicrosoft.Exchange.Management.Powershell.Support 1.0 Support Tasks for the Exchange Server
I can use any other PS script in this forum but somehow even the simple "dir vmstores:\" command not working either ?
The Format-Table -AutoSize cmdlet only shows output on screen when all objects are received.
It can take very long before you see anything on screen due to the size of your datastores.
Try it this way
dir vmstores:\ -Recurse -Include *.iso | Select Name,FolderPath
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes it works without the ft -autosize.
Thanks to all who reply to my thread.
Cheers,
AWT
Just wanted to say thanks for the powercli snippet! Really comes in handy