PowerShell: Drop (remove) the last character from a string
Drop (remove) the last character from a string:
$ComputerName = ‘DCCOMP01$’
$ComputerName = $ComputerName.Substring(0,$ComputerName.Length-1)
$ComputerName
Result is “DCCOMP01″.
This works especially well when the last character is a special PowerShell reserved one like “$”.
(Visited 48,273 times, 1 visits today)
Sean Metcalf
I improve security for enterprises around the world working for TrimarcSecurity.com
Read the About page (top left) for information about me. :)
https://adsecurity.org/?page_id=8
Recent Comments