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.
[link] [1 comment]