Hi all,
I created a powershell script which monitors deduplication stats and the script runs fine for all servers except one. This happens to be the PRTG server itself. If I run the script manually in powershell with all necessary parameters it works flawlessly. Debug output is not very helpful unfortunately.
The Script itself:
param( [string]$ComputerName = '', [string]$Username = '', [string]$Password = '' ) function This-GenerateCredentials() { $SecPasswd = ConvertTo-SecureString $Password -AsPlainText -Force $Credentials= New-Object System.Management.Automation.PSCredential ($Username, $secpasswd) return $Credentials } $results = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-DedupVolume | Select-Object Volume, SavingsRate | Sort-Object Volume } -Credential (This-GenerateCredentials) $xmlOutput = '<?xml version="1.0" encoding="UTF-8" ?><prtg>' foreach ($result in $results) { $xmlOutput = $xmlOutput + "<result><channel>$($result.Volume)</channel><value>$($result.SavingsRate)</value></result>" } $xmlOutput = $xmlOutput + "</prtg>" Out-File -FilePath 'C:\temp\debug.xml' -InputObject $xmlOutput Write-Host $xmlOutput
The generated debug output when run from PRTG:
<?xml version="1.0" encoding="UTF-8" ?><prtg></prtg>
Any help is highly appreciated...
Kind Regards Matthias
Add comment