To split a text at each uppercase letter, without having to provide a list of uppercase characters, try this example:
$text = 'MapNetworkDriveWithCredential' [Char[]]$raw = foreach ($character in $text.ToCharArray()) { if ([Char]::IsUpper($character)) { ' ' } $character } $newtext = (-join $raw).Trim() $newtext