Solve WMI problems on Hyper-V to SCVMM

Fix a common WMI problem for SCVMM to Hyper-V

John Savill

February 10, 2017

1 Min Read
Solve WMI problems on Hyper-V to SCVMM

Q. How can i split a PowerShell string into parts?

A. PowerShell strings have a split function that enables the simple splitting of a string into an array of strings based on a delimiter character.

The example below splits based on the space character and removes any entries that have no actual content.

$FullName = "John Savill "
$Names = $FullName.Split(" ",[StringSplitOptions]'RemoveEmptyEntries')

$Names would contain two entries: John and Savill. The trailing spaces were removed.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like