I am trying to use windows checks as background service and I get the following error while trying to run Get-IcingaFrameworkServiceBinary
PS C:\Users\vagrant> $ServiceData = Get-IcingaFrameworkServiceBinary;
Do you provide a custom source of the service binary? (y/N):
Please enter the path you wish to install the service to (Defaults: "C:\Program Files\icinga-framework-service\"):
[Notice]: Waiting for lock on path "C:\Users\vagrant\AppData\Local\Temp\3\tmp_icinga2038597219.d" to be released before
trying to remove it
[Error]: Failed to remove items from path "C:\Users\vagrant\AppData\Local\Temp\3\tmp_icinga2038597219.d". Recurse is "Tr
ue", Force is "True": "System.IO.IOException: The process cannot access the file 'icinga-service.exe' because it is bein
g used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileInfo.Delete()
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveFileSystemItem(FileSystemInfo fileSystemInfo, Boolean force
)"
Seems like it creates a temp folder with icinga-service.exe and the power shell process locks the folder and then another process tries to delete it but it is unable.
I am following this documentation to download the binary:
Do You have any antivirus with active scan on that server? Maybe it locks the directory and don’t releases till the script finished the installation. I had the same problem with McAfee