Skip to content

Commit 5a80a7e

Browse files
Fixed up True/False values from partner config
1 parent 4ec8b99 commit 5a80a7e

3 files changed

Lines changed: 22 additions & 19 deletions

File tree

Agent/Lib/InstallAgent-Core.psm1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,9 @@ function ValidatePartnerConfig {
678678
$Config.NETFile = $InstallInfo.NETFileName
679679
$Config.NETVersion = $InstallInfo.NETVersion
680680
$Config.NETFileVersion = $InstallInfo.NETFileVersion
681-
$Config.EnforceBehaviorPolicy = $Partner.Config.ServiceBehavior.EnforcePolicy
682-
$Config.ForceAgentCleanup = $Partner.Config.ScriptBehavior.ForceAgentCleanup
683-
$Config.UseWSDLVerifcation = $Partner.Config.ScriptBehavior.UseWSDLVerification
681+
$Config.EnforceBehaviorPolicy = if ($Partner.Config.ServiceBehavior.EnforcePolicy -like "True") {$true} else {$false}
682+
$Config.ForceAgentCleanup = if ($Partner.Config.ScriptBehavior.ForceAgentCleanup -like "True") {$true} else {$false}
683+
$Cofig.UseWSDLVerifcation = if ($Partner.Config.ScriptBehavior.UseWSDLVerification -like "True") {$true} else {$false}
684684

685685
### Function Body
686686
###############################
@@ -1598,23 +1598,21 @@ function TestNCServer {
15981598
}
15991599
# Check if Agent has Connectivity to Server in Partner Configuration
16001600

1601-
if ($Config.UseWSDLVerifcation -and $NCResult -eq $false) {
1601+
if ($Cofig.UseWSDLVerifcation -and $NCResult -eq $false) {
16021602
$client = New-Object System.Net.WebClient
16031603
try {
16041604
$response = $client.DownloadString("https://$($Config.NCServerAddress)/dms2/services2/ServerEI2?wsdl")
16051605
$xmlResponse = [xml]$response
1606-
if ($xmlResponse.definitions.service.port.address.location -eq "https://$($Config.NCServerAddress)/dms2/services2/ServerEI2"){
1606+
if ($xmlResponse.definitions.service.port.address.location -eq "https://$($Config.NCServerAddress)/dms2/services2/ServerEI2") {
16071607
$Flag = "W"
16081608
$Out = ("Device failed ping test, but succeeded on WSDL verification method for " + $NC.Products.NCServer.Name + ", script will proceed with online activities")
16091609
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-
16141610
}
1615-
} catch {
1611+
}
1612+
catch {
1613+
$Flag = "W"
16161614
$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
1615+
Log $Flag 0 $Out
16181616
}
16191617
}
16201618

@@ -3172,21 +3170,23 @@ function InstallAgent {
31723170
### Function Body
31733171
###############################
31743172
### Perform WSDL verfication before attempting any install or removal
3175-
if ($Config.UseWSDLVerifcation) {
3173+
if ($Cofig.UseWSDLVerifcation) {
31763174
$client = New-Object System.Net.WebClient
31773175
try {
31783176
$response = $client.DownloadString("https://$($Config.NCServerAddress)/dms2/services2/ServerEI2?wsdl")
31793177
$xmlResponse = [xml]$response
3180-
if ($xmlResponse.definitions.service.port.address.location -eq "https://$($Config.NCServerAddress)/dms2/services2/ServerEI2"){
3178+
if ($xmlResponse.definitions.service.port.address.location -eq "https://$($Config.NCServerAddress)/dms2/services2/ServerEI2") {
31813179
$Flag = "I"
31823180
$Out = ("WSDL verification succeeded, proceeding with installation actions.")
31833181
Log $Flag 0 $Out
3184-
} else {
3182+
}
3183+
else {
31853184
$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
3185+
$Out = ("WSDL verification failed. Expected: https://$($Config.NCServerAddress)/dms2/services2/ServerEI2 Received:$($xmlResponse.definitions.service.port.address.location)")
3186+
Log $Flag 13 $Out
31883187
}
3189-
} catch {
3188+
}
3189+
catch {
31903190
$Flag = "E"
31913191
$Out = ("WSDL verification method for " + $NC.Products.NCServer.Name + "failed prior to install. Terminating install.")
31923192
Log $Flag 13 $Out -Exit

Agent/PartnerConfig.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ help@mymsp.com
3939
<!-- [REQUIRED - (1-60)] Amount of time (in minutes) to wait for the Windows Installer Service
4040
while another installation is in progress -->
4141
<InstallTimeoutPeriod>5</InstallTimeoutPeriod> <!-- Default Value is 5 -->
42-
<!-- [RECOMMENDED - (True)] - If there are issues with the MSI uninstall of the previous version, perform a cleanup -->
42+
<!-- [REQUIRED - (True)] - If there are issues with the MSI uninstall of the previous version, perform a cleanup -->
4343
<ForceAgentCleanup>True</ForceAgentCleanup>
44+
<!-- [REQUIRED - (True)] - If true enables fallback from ICMP to HTTP/S lookup of the WSDL endpoint for network verification
45+
and pre-install server verification -->
4446
<UseWSDLVerification>True</UseWSDLVerification>
4547
</ScriptBehavior>
4648
<Server>

ReleaseNotes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# 2021-05-7 - 6.0.2
22
* Fixed bug with Invoke-Webrequest not working due to absence of -UseBasicParsing per [#36](https://github.com/AngryProgrammerInside/InstallAgent/issues/36)
33
* Added forced removal/cleanup when bad MSI uninstall information or MSI unable to remove old/rogue agent when needed. [#37](https://github.com/AngryProgrammerInside/InstallAgent/issues/37)
4+
* Added WSDL based server verification for environments where outbound ICMP is disabled [#38](https://github.com/AngryProgrammerInside/InstallAgent/issues/38)
45
* Fixed bug with InstallAgent process not being spun off Async unless -Monitor flag used [#39](https://github.com/AngryProgrammerInside/InstallAgent/issues/39)
5-
6+
* Fixed up Partner Config file validation of True/False attributes
67

78
# 2021-04-12 - 6.0.1
89

0 commit comments

Comments
 (0)