by BassieBas at 2013-03-04 01:14:54
Hello everyone.by mjolinor at 2013-03-04 03:26:12
I have made a powershell script to create a new client with multiple users in our environment.
That is working just fine, but the only thing is that i need to delete te spaces in a variable.
The name of the company (Micro Soft) is used for the OU, Group and directory name.
The only thing is that i need that companyname (Micro Soft) to be without spaces (MicroSoft).
How can i manage to do this? I work with Powershell ISE on a Windows Server 2008R2 environment.
In forward many thanks.
The simplest way to remove the spaces from a string is with the .replace() method:by compugab at 2013-03-04 03:37:48
$var = 'Micro Soft'
$var = $var.replace(' ','')
You could also use a more "PowerShell Way" with -replace like this :by BassieBas at 2013-03-04 03:42:24
$a = "a b c d"
$a -replace " ", ""
That worked, thank you so much for the fast reply!