@@ -680,6 +680,7 @@ function ValidatePartnerConfig {
680680 $Config.NETFileVersion = $InstallInfo.NETFileVersion
681681 $Config.EnforceBehaviorPolicy = $Partner.Config.ServiceBehavior.EnforcePolicy
682682 $Config.ForceAgentCleanup = $Partner.Config.ScriptBehavior.ForceAgentCleanup
683+ $Config.UseWSDLVerifcation = $Partner.Config.ScriptBehavior.UseWSDLVerification
683684
684685 # ## Function Body
685686 # ##############################
@@ -1596,6 +1597,27 @@ function TestNCServer {
15961597 }
15971598 }
15981599 # Check if Agent has Connectivity to Server in Partner Configuration
1600+
1601+ if ($Config.UseWSDLVerifcation -and $NCResult -eq $false ) {
1602+ $client = New-Object System.Net.WebClient
1603+ try {
1604+ $response = $client.DownloadString (" https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2?wsdl" )
1605+ $xmlResponse = [xml ]$response
1606+ if ($xmlResponse.definitions.service.port.address.location -eq " https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2" ){
1607+ $Flag = " W"
1608+ $Out = (" Device failed ping test, but succeeded on WSDL verification method for " + $NC.Products.NCServer.Name + " , script will proceed with online activities" )
1609+ Log $Flag 0 $Out
1610+ } else {
1611+ $Out = (" WSDL verification failed. Expected: https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2 Received:$ ( $xmlResponse.definitions.service.port.address.location ) " )
1612+ Log W 0 $Out
1613+
1614+ }
1615+ } catch {
1616+ $Out = (" WSDL verification method for " + $NC.Products.NCServer.Name + " failed, Offline Repairs will be performed possible until connectivity is restored." )
1617+ Log W 0 $Out
1618+ }
1619+ }
1620+
15991621 $Install.NCServerAccess =
16001622 if ($null -ne $Flag )
16011623 { $true } else { $false }
@@ -3005,7 +3027,8 @@ function RemoveAgent {
30053027 )
30063028 Log E 11 $Out - Exit
30073029 }
3008- } else {
3030+ }
3031+ else {
30093032 # Exit - Agent Removal Failed
30103033 FixServices - Restart
30113034 $Out = (
@@ -3148,6 +3171,28 @@ function InstallAgent {
31483171 WriteKey $Script.Results.ScriptKey $Script.Execution
31493172 # ## Function Body
31503173 # ##############################
3174+ # ## Perform WSDL verfication before attempting any install or removal
3175+ if ($Config.UseWSDLVerifcation ) {
3176+ $client = New-Object System.Net.WebClient
3177+ try {
3178+ $response = $client.DownloadString (" https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2?wsdl" )
3179+ $xmlResponse = [xml ]$response
3180+ if ($xmlResponse.definitions.service.port.address.location -eq " https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2" ){
3181+ $Flag = " I"
3182+ $Out = (" WSDL verification succeeded, proceeding with installation actions." )
3183+ Log $Flag 0 $Out
3184+ } else {
3185+ $Flag = " E"
3186+ $Out = (" WSDL verification failed. Expected: https://$ ( $Config.NCServerAddress ) /dms2/services2/ServerEI2 Received:$ ( $xmlResponse.definitions.service.port.address.location ) . Terminating install" )
3187+ Log $Flag 13 $Out - Exit
3188+ }
3189+ } catch {
3190+ $Flag = " E"
3191+ $Out = (" WSDL verification method for " + $NC.Products.NCServer.Name + " failed prior to install. Terminating install." )
3192+ Log $Flag 13 $Out - Exit
3193+ }
3194+ }
3195+
31513196 # ## Attempt Agent Installation
31523197 for (
31533198 $Install.ChosenMethod.FailedAttempts = 0
0 commit comments