Skip to content

Commit 2f250b7

Browse files
Merge pull request #40 from AngryProgrammerInside/6.0.2a-WSDL-verification
6.0.2a wsdl verification
2 parents 9659b96 + dd7107e commit 2f250b7

4 files changed

Lines changed: 73 additions & 14 deletions

File tree

Agent/Lib/InstallAgent-Core.psm1

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +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
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+
$Config.UseWSDLVerifcation = if ($Partner.Config.ScriptBehavior.UseWSDLVerification -like "True") {$true} else {$false}
683684

684685
### Function Body
685686
###############################
@@ -1596,6 +1597,25 @@ 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+
}
1611+
}
1612+
catch {
1613+
$Flag = "W"
1614+
$Out = ("WSDL verification method for " + $NC.Products.NCServer.Name + "failed, Offline Repairs will be performed possible until connectivity is restored.")
1615+
Log $Flag 0 $Out
1616+
}
1617+
}
1618+
15991619
$Install.NCServerAccess =
16001620
if ($null -ne $Flag)
16011621
{ $true } else { $false }
@@ -3005,7 +3025,8 @@ function RemoveAgent {
30053025
)
30063026
Log E 11 $Out -Exit
30073027
}
3008-
} else {
3028+
}
3029+
else {
30093030
# Exit - Agent Removal Failed
30103031
FixServices -Restart
30113032
$Out = (
@@ -3148,6 +3169,30 @@ function InstallAgent {
31483169
WriteKey $Script.Results.ScriptKey $Script.Execution
31493170
### Function Body
31503171
###############################
3172+
### Perform WSDL verfication before attempting any install or removal
3173+
if ($Config.UseWSDLVerifcation) {
3174+
$client = New-Object System.Net.WebClient
3175+
try {
3176+
$response = $client.DownloadString("https://$($Config.NCServerAddress)/dms2/services2/ServerEI2?wsdl")
3177+
$xmlResponse = [xml]$response
3178+
if ($xmlResponse.definitions.service.port.address.location -eq "https://$($Config.NCServerAddress)/dms2/services2/ServerEI2") {
3179+
$Flag = "I"
3180+
$Out = ("WSDL verification succeeded, proceeding with installation actions.")
3181+
Log $Flag 0 $Out
3182+
}
3183+
else {
3184+
$Flag = "E"
3185+
$Out = ("WSDL verification failed. Expected: https://$($Config.NCServerAddress)/dms2/services2/ServerEI2 Received:$($xmlResponse.definitions.service.port.address.location)")
3186+
Log $Flag 13 $Out
3187+
}
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

Agent/PartnerConfig.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ 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 -->
46+
<UseWSDLVerification>True</UseWSDLVerification>
4447
</ScriptBehavior>
4548
<Server>
4649
<!-- [REQUIRED - (URL Without Protocol)] Your N-Central Server Address (get this from the

ReadMe.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## Table of Contents
44
- [InstallAgent Automation Suite](#installagent-automation-suite)
5-
* [Table of Contents](#table-of-contents)
65
* [Introduction](#introduction)
7-
* [New and improved Features since AgentDeploymentPackage in 6.0.0](#new-and-improved-features-since-agentdeploymentpackage-in-600)
6+
* [Status of Suite](#status-of-suite)
7+
* [Release notes for 6.0.2](#release-notes-for-602)
8+
* [Release notes for 6.0.1](#release-notes-for-601)
9+
* [New and improved Features in AgentDeploymentPackage 6.0.0](#new-and-improved-features-in-agentdeploymentpackage-600)
810
* [Key Features](#key-features)
911
- [The "Registration Token" - Agent Deployment and Considerations](#the--registration-token----agent-deployment-and-considerations)
1012
* [History](#history)
@@ -28,6 +30,7 @@
2830
* [1a - Setup the N-Central Custom Service (Version 6.xx)](#1a---setup-the-n-central-custom-service--version-6xx-)
2931
* [1b - Setup AMP based PartnerConfiguration update amps](#1b---setup-amp-based-partnerconfiguration-update-amps)
3032
* [1c - Setup AMP based PartnerConfiguration update amps](#1c---setup-amp-based-partnerconfiguration-update-amps)
33+
* [1d - Setup AMP based monitoring of the PartnerConfig.xml file](#1d---setup-amp-based-monitoring-of-the-partnerconfigxml-file)
3134
+ [Update PartnerConfig from CP](#update-partnerconfig-from-cp)
3235
+ [Update PartnerConfig from JWT](#update-partnerconfig-from-jwt)
3336
* [2 - Review Deployment Package Results](#2---review-deployment-package-results)
@@ -48,20 +51,27 @@
4851
## Introduction
4952
This is a community-based Automation Suite intended as a replacement for the stock N-central Group Policy Installer Script as provided by N-able. It is not supported by N-able, so please do not contact their support department regarding any problems or questions about this script. In addition, please do not contact the support departments of any individual Partners in the Community regarding the Automation Suite or its components.
5053

54+
This suite is a fork of [Ryan Crowther Jr's AgentDeploymentPackage on GitHub](https://github.com/N-able/AgentDeploymentPackage/) and will soon be the future branch going forward as they have moved on to other projects.
55+
56+
If you discover a problem with any component of the Automation Suite or have ideas on how it could be improved, [post an issue on GitHub](https://github.com/AngryProgrammerInside/InstallAgent/issues). Alternatively, post on the N-Central Slack Community chat.
57+
58+
These tools are provided as-is, in the best of faith, by those Partners and Community Members involved in their development. If you use this in your environment, we would love to hear from you on GitHub!
59+
5160
## Status of Suite
5261
All scripts in the suite have been run and tested as functional. It is currently considered in a 'beta' phase while wider testing is being performed.
5362

5463
Feel free to provide feedback and lodge issues and they will be reviewed.
5564

56-
## New and improved Features in AgentDeploymentPackage 6.0.1 (Beta)
65+
## Release notes for 6.0.2
66+
* Fixed several small bugs, full [Release Notes](ReleaseNotes.md)
67+
* Added WSDL endpoint based N-Central Server verification for environments where Echo/ICMP is blocked, or where additional verification that the server N-Central is up and accessible. Enabled by setting the `<UseWSDLVerification>` attribute to **True**
68+
* Added forced removal/cleanup when bad MSI uninstall information or MSI unable to remove old/rogue agent when needed using the AgentCleanup4.exe. Enabled by setting the `<ForceAgentCleanup>` attribute to **True**
5769

58-
This script is a fork of [Ryan Crowther Jr's AgentDeploymentPackage on GitHub](https://github.com/N-able/AgentDeploymentPackage/) and will soon be the future branch going forward as they have moved on to other projects.
59-
60-
If you discover a problem with any component of the Automation Suite or have ideas on how it could be improved, [post an issue on GitHub](https://github.com/AngryProgrammerInside/InstallAgent/issues). Alternatively, post on the N-Central Slack Community chat.
61-
62-
These tools are provided as-is, in the best of faith, by those Partners and Community Members involved in their development. If you use this in your environment, we would love to hear from you on GitHub!
70+
## Release notes for 6.0.1
71+
* Fixed a large number of bugs, full [Release Notes](ReleaseNotes.md)
72+
* Added the ability enable/disable service policy enforcement with `<EnforcePolicy>` attribute for service timeouts/restarts. By default is now **False** as the service policy can get overriden by the maintenance service eventually.
6373

64-
## New and improved Features in AgentDeploymentPackage 6.0.1
74+
## New and improved Features in AgentDeploymentPackage 6.0.0
6575

6676
![](media/readme-image8.png)
6777
* Registration token install method:

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)