I want to have some function like below
function get-diskinfo {
[string[]]$ComputerName
# some stuff here
}
so I can use it like
get-diskinfo -ComputerName com1,com2,com3
if (!$?) { # I want to caller to check this, so the experience is same as built-in cmdlet
write-error "failed to get disk info for some computer"
}
however after googling, still no idea to generate non terminating error from get-diskinfo, any idea how to do this? thank you in advance!