Skip to content

Commit 8e09929

Browse files
More documentation, resolved newline issue in logs
1 parent 93c783f commit 8e09929

3 files changed

Lines changed: 26 additions & 25 deletions

File tree

Agent/Lib/InstallAgent-Core.psm1

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function Quit {
129129
if ($Code -match $SC.Validation.InternalErrorCode) {
130130
$Script.Results.Function = $Function.Name
131131
$Script.Results.LineNumber = $Function.LineNumber
132-
$Script.Results.Details += @("`Name== Error Details ==")
132+
$Script.Results.Details += @("`n== Error Details ==")
133133
$Script.Results.Details += @($SC.Exit.$LCode.ExitMessage)
134134
$Script.Results.Details +=
135135
if ($null -ne $Script.Results.Function)
@@ -146,7 +146,7 @@ function Quit {
146146
}
147147
### Format the Message Data for the Event Log
148148
# Add the Overall Script Result
149-
$Script.Results.EventMessage += @("Overall Script Result: " + $SC.Exit.$LCode.ExitType + "`Name")
149+
$Script.Results.EventMessage += @("Overall Script Result: " + $SC.Exit.$LCode.ExitType + "`n")
150150
# Add the Completion Status of Each Sequence
151151
$Script.Sequence.Order |
152152
ForEach-Object {
@@ -156,20 +156,20 @@ function Quit {
156156
) -join ' - '
157157
}
158158
# Add the Detailed Messages for Each Sequence
159-
$Script.Results.EventMessage += @("`Name" + ($Script.Results.Details -join "`Name"))
159+
$Script.Results.EventMessage += @("`n" + ($Script.Results.Details -join "`n"))
160160
# For Typical Errors, Add the Branded Error Contact Message from Partner Configuration
161161
if (
162162
($Code -ne 999) -and
163163
($Code -ne 0) -and
164164
($null -ne $Config.ErrorContactInfo)
165165
) {
166166
$Script.Results.EventMessage +=
167-
"`Name--=========================--",
168-
"`nTo report this documented issue, please submit this Event Log entry to:`Name",
167+
"`n--=========================--",
168+
"`nTo report this documented issue, please submit this Event Log entry to:`n",
169169
$Config.ErrorContactInfo
170170
}
171171
# Combine All Message Items
172-
$Script.Results.EventMessage = ($Script.Results.EventMessage -join "`Name").TrimEnd('')
172+
$Script.Results.EventMessage = ($Script.Results.EventMessage -join "`n").TrimEnd('')
173173
### Publish Execution Results to the Event Log
174174
# Create a New Key for the Event Source if Required
175175
if ((Test-Path $Script.Results.ScriptEventKey) -eq $false)
@@ -235,7 +235,7 @@ function Log {
235235
($Message -is [Array]))
236236
) {
237237
if ($Message -is [Array])
238-
{ $Message = $Message -join "`Name" }
238+
{ $Message = $Message -join "`n" }
239239
}
240240
else {
241241
# ERROR - Invalid Parameter
@@ -299,15 +299,15 @@ function Log {
299299
{ ($SC.SequenceStatus.B + " ($Code)"); break }
300300
}
301301
# Add Detail Message to Current Sequence
302-
$Script.Results.Details += @("`Name" + $Message)
302+
$Script.Results.Details += @("`n" + $Message)
303303
}
304304
if ($EndSequence -eq $true) {
305305
# Change Status to COMPLETE Unless Otherwise Specified
306306
$Status =
307307
if ($Script.Sequence.Status[-1] -eq $SC.SequenceStatus.C)
308308
{ $SC.SequenceStatus.A } else { $Script.Sequence.Status[-1] }
309309
# Add Sequence Footer After Detail Message
310-
$Script.Results.Details += @("--== " + $Script.Execution.ScriptSequence + " Finished ==--`Name")
310+
$Script.Results.Details += @("--== " + $Script.Execution.ScriptSequence + " Finished ==--`n")
311311
}
312312
# Update the Event Log Sequence Status
313313
$SelectedStatus = [Array]::IndexOf($Script.Sequence.Order, $Sequence)
@@ -354,11 +354,11 @@ function CatchError {
354354
$Out +=
355355
"== Command Details ==",
356356
("Faulting Line Number: " + $ExcCmdLN),
357-
("Faulting Command: " + $ExcCmd + "`Name")
357+
("Faulting Command: " + $ExcCmd + "`n")
358358
}
359359
$Out +=
360360
"== Error Message ==",
361-
($ExcMsg -join "`Name")
361+
($ExcMsg -join "`n")
362362
}
363363
Log E $Code $Out
364364
if ($Exit -eq $true) { Quit $Code }
@@ -1076,7 +1076,7 @@ function ValidatePartnerConfig {
10761076
# Report on any Invalid Configuration Items
10771077
if ($null -ne $InvalidConfig) {
10781078
$Out =
1079-
"One or more items in the Partner Configuration was invalid.`Name",
1079+
"One or more items in the Partner Configuration was invalid.`n",
10801080
"Please verify the following values:"
10811081
$InvalidConfig |
10821082
Sort-Object |
@@ -1154,7 +1154,7 @@ function ValidateExecution {
11541154
Select-Object -ExpandProperty TotalSeconds
11551155
)
11561156
$Out =
1157-
("Windows has booted within the " + $Config.BootTimeWaitPeriod + "-second Wait Period specified in the Partner Config.`Name"),
1157+
("Windows has booted within the " + $Config.BootTimeWaitPeriod + "-second Wait Period specified in the Partner Config.`n"),
11581158
("Waiting the remaining " + $WaitTime + " seconds before Diagnosis...")
11591159
Log I 0 $Out
11601160
Start-Sleep -Seconds $WaitTime
@@ -1522,9 +1522,9 @@ function TestNCServer {
15221522
$Out = @(
15231523
switch ($GoogleResult) {
15241524
$false
1525-
{ "Device appears not to have Internet connectivity at present.`Name"; break }
1525+
{ "Device appears not to have Internet connectivity at present.`n"; break }
15261526
$true
1527-
{ ("Device appears to have Internet connectivity, but is unable to reliably connect to the " + $NC.Products.NCServer.Name + ".`Name"); break }
1527+
{ ("Device appears to have Internet connectivity, but is unable to reliably connect to the " + $NC.Products.NCServer.Name + ".`n"); break }
15281528
},
15291529
"The Script will assess and perform Offline Repairs where possible until connectivity is restored."
15301530
)
@@ -2821,7 +2821,7 @@ function SelectInstallMethod {
28212821
# ERROR - No Installation Methods Remaining
28222822
MethodSummary
28232823
$Out =
2824-
("All available Methods and Attempts to install the " + $NC.Products.Agent.Name + " were unsuccessful.`Name"),
2824+
("All available Methods and Attempts to install the " + $NC.Products.Agent.Name + " were unsuccessful.`n"),
28252825
("Review the Event Log for any entries made by the " + $NC.Products.Agent.InstallerName + " Event Source for more details.")
28262826
Log E 12 $Out -Exit
28272827
}
@@ -2875,7 +2875,7 @@ function CheckMSIService {
28752875
# Exit - Windows Installer Service Unavailable
28762876
$Out = (
28772877
"The Windows Installer Service has been unavailable for the timeout period of " +
2878-
$Config.InstallTimeoutPeriod + " minutes.`Name`Name" +
2878+
$Config.InstallTimeoutPeriod + " minutes.`n`n" +
28792879
"This could be due to an Installer that is requesting user input to continue. "
28802880
)
28812881
$Out +=
@@ -2931,7 +2931,7 @@ function InstallNET {
29312931
)
29322932
if ($Device.NETProduct -lt (ValidateVersion $Config.NETVersion 2)) {
29332933
# Exit - .NET Framework Installation Failed
2934-
$Out += ". An error occurred during installation.`Name`nReview the Event Log for relevant details."
2934+
$Out += ". An error occurred during installation.`n`nReview the Event Log for relevant details."
29352935
Log E 10 $Out -Exit
29362936
}
29372937
$Out += " and was installed successfully."
@@ -2985,7 +2985,7 @@ function VerifyPrerequisites {
29852985
if ($Install.NCServerAccess -eq $false) {
29862986
# Exit - Installer will Fail to Authenticate with Server
29872987
$Out =
2988-
("The Device is currently unable to reliably reach the " + $NC.Products.NCServer.Name + ". Installation attempts will fail authentication.`Name"),
2988+
("The Device is currently unable to reliably reach the " + $NC.Products.NCServer.Name + ". Installation attempts will fail authentication.`n"),
29892989
"This may be caused by lack of Internet connectivity, a poor connection, or DNS is unavailable or unable to resolve the address.",
29902990
"If this issue persists, verify the <NCServerAddress> value in the Partner Configuration is correct."
29912991
Log E 6 $Out -Exit
@@ -3005,11 +3005,11 @@ function VerifyPrerequisites {
30053005
# Exit - No Available Installation Methods
30063006
$Out =
30073007
if ($null -eq $CustomerID) {
3008-
@("An " + $NC.Products.Agent.IDName + " was not provided to the Script and is required for Installation.`Name")
3008+
@("An " + $NC.Products.Agent.IDName + " was not provided to the Script and is required for Installation.`n")
30093009
$ExitCode = 7
30103010
}
30113011
else {
3012-
@("The " + $NC.Products.Agent.IDName + " provided to the Script [" + $CustomerID + "] is invalid. A valid Customer ID is required for Installation.`Name")
3012+
@("The " + $NC.Products.Agent.IDName + " provided to the Script [" + $CustomerID + "] is invalid. A valid Customer ID is required for Installation.`n")
30133013
$ExitCode = 8
30143014
}
30153015
$Out +=

ReadMe.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,14 @@ Scenario 3: The package is deployed as above. LaunchInstaller is set to read par
254254

255255
# Preparation
256256

257-
## 1 - Update the Partner Configuration
257+
## 1 - Updating the Partner Configuration
258258

259259
**The developers recommend editing the Partner Configuration (PartnerConfig.xml) with Visual Studio Code, however feel free to use your favorite text editor that supports "UTF-8 w/ BOM" Encoding.**
260260

261261
Open **PartnerConfig.xml** to begin. This **Partner Configuration** is your one-stop shop for configuring the **Deployment Package.** Enter data for each value between the relevant XML Tags (many values are already assigned Defaults to serve as an example). Information about the Expected Format and Purpose of each Configuration Value is contained above each value itself. Consider the table below a desk reference.
262262

263+
In normal circumstances you would configure values like Service Behavior and Script Behavior, then the rest will be updated/injected via the provided AMPs.
264+
263265
| Category | Value Name | Default Value | Mandatory | Purpose |
264266
| -------- | ---------- | ------------- | --------- | ------- |
265267
| **Branding** | *ErrorContactInfo* | | No | This is a space for your business contact info (Company Name, Address, Support Phone Number, etc.). This will be printed at the bottom of the Event Log entry when a documented error occurs. If using multiple lines, start your information at the **beginning of each line** (no indent) in the tag space. |
@@ -299,7 +301,6 @@ A small amount of customization can also be made in the **Agent Launcher Script*
299301
| Value Name | Default Value | Mandatory | Purpose |
300302
| ---------- | ------------- | --------- | ------- |
301303
| *TempFolder* | C:\Windows\Temp\AGPO | Yes | This should be a Local Folder on the system where the **Deployment Package** components work from, **NOT to be confused with the *LocalFolder* value in the Partner Configuration.** Whether run by Group Policy or On-Demand (click-to-run), the required components are dropped here during execution and then **removed upon termination of the Package.** |
302-
| *DLThreshold* | 3 | Yes | This is the maximum number of attempts the **Agent Setup Launcher** will make to download any prerequisite components needed for Agent installation. If this value is exceeded, the **Launcher will terminate, and it must be run again.** |
303304
| *NoArgs* | 0 | Yes | Disable the usage of arguments passed to this script. This way you can **not** pass CustomerID and Token through arguments, but if you have an older GPO that still uses a domainname or the term AUTO, you can set this value to 1. This way you don't need to change all those GPO's. **If set to 1, you do need another way to pass CustomerID and Token, or through the PartnerConfig.xml, or through azNableProxy** |
304305

305306
If you elect to make any changes, you will need to adjust the values **immediately following the equals (=) sign** in their relevant **SET** statements. For example:

ReleaseNotes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# 2020-02-xx
2-
New and updated features:
32
* Registration token install method:
43
* Activation Key methods for upgrades
54
* Registration Key methods for new installs/repairs
@@ -11,6 +10,7 @@ New and updated features:
1110
* Functioning N-Central AMP scripts that support 2 methods for updating the configuration file used for installation
1211
* Direct update of Customer ID/Registration Token and other values from N-Central Custom Property (CP) injected via N-Central API See: [How to N-Central API Automation](https://github.com/AngryProgrammerInside/NC-API-Documentation) for examples
1312
* Automatic update of Customer ID/Registration token from values pulled from local Agent/Maintenance XML along with provided JWT (see above documentation)
13+
* Functioning N-Central AMP script to update/renew expired/expiring tokens
1414
* Legacy Support: If you still have old values within your GPO, you can use a flag within the LaunchInstaller.bat to ignore provided parameters and rely upon the configuration file
1515
* Custom installation method data
1616
* Through additional modules you can use your own source for CustomerID/Registration Token enumeration
@@ -21,7 +21,7 @@ New and updated features:
2121
* Quality of Life for development and debugging:
2222
* Added debugmode to the InstallAgent.ps1 to avoid self destruct and reload of modules
2323
* Added debug function to provide Gridviews of common tables
24-
* For more details on development debugging of this script, [check out this readme](DevelopmentAndDebugging.md)
24+
* For more details on development debugging of this script, check out this page on GitHub
2525

2626
# 2019-08-26
2727

0 commit comments

Comments
 (0)