Page 1 of 1

powershell nsclient - cannot access file it is being used

Posted: Mon Mar 14, 2022 2:48 am
by netanelp
Hey guys,
I'm using nsclient on one of my windows machines and for some reason I keep getting an 'UNKNOWN' status on the check every one in a while.
I'm running a powershell script with this command:

Code: Select all

Check_test = cmd /c echo scripts\check_test "vm-test"; exit($lastexitcode) | powershell.exe -Command - 2> $null
The check itself works and most of the time i'm getting a correct reading but sometimes i'm getting the following.
powershell.exe -command - 2> $null) returned an invalid return code: 255: The process cannot access the file because it is being used by another process.
-Running from the cli nagios machine gets the result back just fine all the time.


What is locking this file?nagios itself?