Skip to content
Categories:

Split/Join Powershell

Post date:
Author:

An example on how you can use split and join to get the result you need.

1
2
3
$vm = 'mykickassvm.my.domain.com'
$domain = ($vm.Split('.') | Select-Object -skip 1) -join ('.')
$vmName = $vm.Split('.')[0]