I need to get rid of an object ($deletehostname) in an array and have the following code:
$deletehostname is successfully removed, but it is replaced by an open line.if ($BackConnectionHostnamesExists) { $zero="" $ExistingHostnames = ($BackConnectionHostnamesExists.BackConnectionHostnames) $ExistingHostnames = $ExistingHostnames.replace($deletehostname, $zero) Set-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa\MSV1_0 -Name "BackConnectionHostnames" -value $ExistingHostnames }
so if $deletehostname = test3, my result is:
test1
test2
test4
test5
I would love to get rid of that empty space! So is it possible to replace by nothing?
br
Bjorn