Perfect...thanks again...but...when I run the following commands separately from the Powershell command line they work fine...
-
Add-PSSnapin VMWare.VImAutomation.Core
"C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1"
Add-Module "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\coreModule\viToolkitExtensions.psm1"
Connect-VIServer -Server 192.168.xxx.xxx -User xxx -Password xxx
Get-Datastore | get-tkedatastorefile | where { $_.Path -match "delta" } | format-list * > c:\deltachk.txt
-
...but when I run them inside a script using "PowerShell.exe c:\deltachk.ps1" I get the following errors...
-
Get-View : 10/10/2008 11:28:32 AM Get-View You are not currently connected to any servers. Please connect first using Connect-VIServer or one of its aliases.
At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\coreModule\viToolkitExtensions.psm1:460 char:28
+ $datastoreView = get-view <<<< $ds.id
Get-View : The argument cannot be null or empty.
At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\coreModule\viToolkitExtensions.psm1:461 char:31
+ $datastoreBrowser = get-view <<<< $datastoreView.browser
You cannot call a method on a null-valued expression.
At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\coreModule\viToolkitExtensions.psm1:468 char:59
+ $task = $datastoreBrowser.SearchDatastoreSubFolders_Task <<<< ("[$name] /$subpath", $spec)
-
...what am I doing wrong???
Thank you...MIke
Message was edited by: kastek