Hi ,
I would like to use ERROR handling with Try&Catch, that can handle $computername variable, if computer is not found, message comes up: "hey I did not find computer with this name"
to where should I insert try&catch to, in my stuff? a little explanation would be appreciated..
#OSversion attempt:
$ends = ""
while ($ends -ne "END") {
$computername = Read-Host "Enter Server's Name "
Get-WmiObject -Class Win32_OperatingSystem -ComputerName $computername | format-list (
@{n='ServerName'={$computername}},
@{n='WindowsVesrion'={$_.Caption}},
@{n='BITVersion'={$_.osarchitecture}},
@{n='VersionNumber'={$_.Version}},
@{n='ServicePack'={$_.ServicePackMajorVersion}}
)
}
$ends = read-host "Continue or END "
Thank you in advance