Share via

Convert Powershell script to VBNet

Nagaraj 1 Reputation point
2022-04-18T11:41:47.583+00:00

Param(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true)]
[string]
$SixDigitRestaurantCode
)
try
{
if(($SixDigitRestaurantCode -ne $null) -and ($SixDigitRestaurantCode.Length -eq 6)
-and (($SixDigitRestaurantCode.ToUpper().Substring(0,2) -eq "C0")
-or ($SixDigitRestaurantCode.ToUpper().Substring(0,2) -eq "MG")))
{
$addr = [String]::Format("{0}BServer",$SixDigitRestaurantCode)
$res = [Net.DNS]::GetHostAddresses([String]::Format("{0}BServer",$SixDigitRestaurantCode))
return $addr
}
else {
return "Invalid SixDigitRestaurantCode"
}
}
catch
{
$addr = [String]::Format("{0}Server",$SixDigitRestaurantCode)
return $addr
}
Could someone help me to convert the above PS script to VBNet.

Developer technologies | VB

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.