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-ClassWin32_OperatingSystem-ComputerName$computername|format-list (
@{n='ServerName';e={$computername}},
@{n='WindowsVesrion';e={$_.Caption}},
@{n='BITVersion';e={$_.osarchitecture}},
@{n='VersionNumber';e={$_.Version}},
@{n='ServicePack';e={$_.ServicePackMajorVersion}}
)
}
$ends=read-host"Continue or END "
Thank you in advance