Initialize-LmConnectionParameters -Address 10.101.50.1 -LBPort 443 -Credential bal -Verbose

# Set variables 
$ContentMatchingRuleName = "$CRPCEN_Authentic"
$ContentMatchingRulePattern = "/^\/$CRPCEN-Authentic.*/" 
$VirtualServiceName = "10.80.20.2" 
$VirtualServicePort = 443
$RealServerName = "xx-P-IIS-011.xx.net" 
$RealServerPort = 80 
$CheckUrl = "xx.xx.com"

# Create Content Rule 
New-AdcContentRule -RuleName $ContentMatchingRuleName -Header Host -MatchType regex -Pattern $ContentMatchingRulePattern -NoCase true

# Create Sub Virtual Service 
$NASVS = New-AdcSubVirtualService -VirtualService $VirtualServiceName -VSPort $VirtualServicePort -VSProtocol tcp
$NASVSIndex = ($NASVS.Data.VS.SubVS[-1]).VSIndex 
Set-AdcSubVirtualService -SubVSIndex $NASVSIndex -CheckHost $RealServerName -CheckPort $RealServerPort -CheckType http -CheckUrl $CheckUrl -CheckUse1_1 1 -Nickname $CheckUrl -VSType http -Weight 1000
Set-AdcSubVirtualService -SubVSIndex $NASVSIndex -CheckHost $RealServerName -CheckPort $RealServerPort -CheckType http -CheckUrl $CheckUrl -CheckUse1_1 1 -Nickname $CheckUrl -VSType http -Weight 900

# Add Real Server to Sub Virtual Service (disabled) 
New-AdcRealServer -RealServer $RealServerName -RealServerPort $RealServerPort -Enable $true -Forward nat -VSIndex $NASVSIndex -Weight 1000
