I'm trying to pass variables to openfiles.exe but it is failing. I've tested the same code from the powershell ISE and it works without issue.
Error:
ERROR: openfiles.exe : ERROR: Invalid ID.
MainForm.psf (490, 4): ERROR: At Line: 490 char: 4
ERROR: + openfiles.exe /disconnect /s SERVER /ID $fi
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (ERROR: Invalid ID.:String) [], RemoteException
ERROR: + FullyQualifiedErrorId : NativeCommandError
ERROR:f
ERROR: Type "OPENFILES /Disconnect /?" for usage.
ERROR:
ISE code:
$list = @(
"57951384"
"56718140"
)
foreach($fi in $list)
{ openfiles /disconnect /s Server /ID $fi}
Trying to pass variables to a command line exe
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- simon.briggs
- Posts: 10
- Last visit: Mon Feb 01, 2021 6:18 am