Here is the new Script. I changed it and it looks like its in the correct format.
I still get this response in PRTG.
Error reading response: Junk after document element </prtg>
Any thoughts?
#start new remote session from powershell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://gemini1/PowerShell/ -Authentication Kerberos
#import new session
Import-PSSession $Session -DisableNameChecking
$server=Get-MailboxDatabase -Status | select Identity,AvailableNewMailboxSpace
foreach ($_.Identity in $server) {
$Name=$_.Identity
$Data=$_.AvailableNewMailboxSpace
Write-Host
"<prtg>"
"<result>"
"<channel>$Name</channel>"
"<value>$Data</value>"
"</result>"
"</prtg>"
}
Here is the new output
<prtg>
<result>
<channel>WH Employees 01</channel>
<value>169.3 MB (177,569,792 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Old Employees 01</channel>
<value>118 MB (123,731,968 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Old Employees 02</channel>
<value>9.031 MB (9,469,952 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Service Mailboxes 01</channel>
<value>931.8 MB (977,010,688 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>WH Employees 02</channel>
<value>2.708 GB (2,907,996,160 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>WH Employees 03</channel>
<value>68.06 MB (71,368,704 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>WH Employees 06</channel>
<value>131.5 MB (137,887,744 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Spam 01</channel>
<value>336.5 MB (352,878,592 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Mailbox Database 1640716322</channel>
<value>1.688 MB (1,769,472 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>SyncTest</channel>
<value>71.22 MB (74,678,272 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>WH Employees 15</channel>
<value>1.219 GB (1,308,524,544 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>OC Employees 02</channel>
<value>129.8 MB (136,118,272 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>OC Employees 11</channel>
<value>54.94 MB (57,606,144 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Contractors 11</channel>
<value>170.8 MB (179,142,656 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>WH Employees 14</channel>
<value>34.25 MB (35,913,728 bytes)</value>
</result>
</prtg>
<prtg>
<result>
<channel>Remote Employees 01</channel>
<value>4.921 GB (5,284,265,984 bytes)</value>
</result>
</prtg>
Add comment