Hello,
I am currently trying to monitor a file via a powershell script in other domain. It's a forrest where all domains are trusted.
The Probe is located in domain A which can execute the script and can fetch the file on servers in domain A. When I am trying to execute this script for a server which is located in domain B, the script cannot get the item and says "access denied".
Basically the Probe in domain A needs to monitor a file in Domain B via powershell.
#### Script #### param([string]$path)
$file = Get-Item -Path $path
if(!(Test-Path $path)) {
New-Item -Path $path exit 0 } else{
if ($file.LastWriteTime -le ((Get-Date).AddHours(-1)) ) { Write-Host "2:File Age is older than 60 minutes (file age: $file.LastWriteTime)" exit 2 } }
write-host "0:ok"
#### End ####
We currently are right in the middle of a domain migration, therefore I cannot create a probe for every domain just to run the script and monitor only one file/one server.
The credential for each domain are different, but the correct ones are configured in the credentials area in PRTG. Is it possible to tell PRTG to use specific credentials for the execution of a powershell script?
Is there any "easier" way to monitor file with the following functions?
- Check if the file exists, if no then create the file and go ok
- Check the file age, if it's older than 60 minutes go critical otherwise say ok
Add comment