I'm trying to run this in one line using the "Run" command:
powershell -NoExit ; Get-ChildItem -Recurse -force -Include *.ost \\PcHostname\c$\users -ErrorAction "SilentlyContinue" | ls | Select-Object Name, @{Name="GigaBytes";Expression={$_.Length / 1GB}}
but I get this error:
GigaBytes : The term 'GigaBytes' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:137
+ ... t Name, @{Name=GigaBytes;Expression={$_.Length / 1GB}}
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (GigaBytes:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The code works on a started Powershell window without powershell -NoExit ;
.
Any ideas to fix it?