Quantcast
Channel: Sysadmin
Viewing all articles
Browse latest Browse all 165471

Powershell output Help

$
0
0

Kind of stuck here. I need some help.

I have a very simple powershell script that I'm going to tie to our monitoring software (PRTG).

$Derp=get-wmiObject win32_operatingSystem -Computer *computername* | Select FreePhysicalMemory $output=$Derp.FreePhysicalMemory | Out-file C:\Temp\temp.dat $File=gc C:\temp\Temp.dat $New=$File.Replace("`r`n","") $New 

The script is dirty but runs fine. It grabs the amount of memory used by the server. The problem is at the end of the output it is putting in a carriage return character and line feed character at the end.

Output looks like this:

5699904CRLF 

How can I strip off the carriage return and line feed off the output? I tried

$File.Replace("`r`n","") 

but it doesn't seem to work.

submitted by tcpip4lyfe
[link] [1 comment]

Viewing all articles
Browse latest Browse all 165471

Trending Articles