Hi have this ps script
Param ( [String]$fPath ) $cont = (Get-ChildItem $fPath -File | ? {$_.LastWriteTime -gt (Get-Date -format "MM/dd/yyyy") }).Count $xmlstring = "<?xml version=`"1.0`"?>`n <prtg>`n" $xmlstring += " <result>`n" $xmlstring += " <channel>File</channel>`n" $xmlstring += " <unit>Custom</unit>`n" $xmlstring += " <CustomUnit>num</CustomUnit>`n" $xmlstring += " <mode>Absolute</mode>`n" $xmlstring += " <showChart>1</showChart>`n" $xmlstring += " <showTable>1</showTable>`n" $xmlstring += " <float>0</float>`n" $xmlstring += " <value>$cont</value>`n" $xmlstring += " <LimitMode>1</LimitMode>`n" $xmlstring += " </result>`n" $xmlstring += " </prtg>" Write-Host $xmlstring
If I run this manualy it's ok, but if I can to run this with PRTG EXE/XML Advanded return : Network Path not found
Why???
manually
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Set-ExecutionPolicy -ExecutionPolicy Unrestricted PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> .\checkBKAs400.ps1 -fPath \\192.168.10.21\backup\As400\Sardus\FTP <?xml version="1.0"?> <prtg> <result> <channel>File Backup</channel> <unit>Custom</unit> <CustomUnit>File</CustomUnit> <mode>Absolute</mode> <showChart>1</showChart> <showTable>1</showTable> <float>0</float> <value>13</value> <LimitErrorMsg>Errore nel backup</LimitErrorMsg> <LimitMode>1</LimitMode> </result> </prtg> EXE Log Get-ChildItem : Impossibile trovare il percorso '\\192.168.xx.xx\backup\As400\Sardus\ftp' perch‚ non esiste. In C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\checkBKAs400.ps1:8 car:10 + $cont = (Get-ChildItem -LiteralPath $fPath -File | ? {$_.LastWriteTi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\\192.168.xx.xx\backup\As400\Sardus\ftp:String) [G et-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand <?xml version="1.0"?> <prtg> <result> <channel>File Backup</channel> <unit>Custom</unit> <CustomUnit>File</CustomUnit> <mode>Absolute</mode> <showChart>1</showChart> <showTable>1</showTable> <float>0</float> <value>0</value> <LimitErrorMsg>Errore nel backup</LimitErrorMsg> <LimitMode>1</LimitMode> </result> </prtg>
Add comment