powershell nsclient - cannot access file it is being used

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
netanelp
Posts: 5
Joined: Mon Aug 02, 2021 3:47 am

powershell nsclient - cannot access file it is being used

Post 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?
Locked