Skip to content

Commit 4dfcd13

Browse files
committed
Install and Uninstall - Try both HTTP and HTTPS
1 parent f3cbe8b commit 4dfcd13

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

LabTech.psm1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ Function Uninstall-LTService{
545545
This will uninstall the LabTech agent using the provided server URL to download the uninstallers.
546546
547547
.NOTES
548-
Version: 1.7
548+
Version: 1.8
549549
Author: Chris Taylor
550550
Website: labtechconsulting.com
551551
Creation Date: 3/14/2016
@@ -579,6 +579,9 @@ Function Uninstall-LTService{
579579
Update Date: 1/21/2019
580580
Purpose/Change: Minor bugfixes/adjustments.
581581
Allow single label server name.
582+
583+
Update Date: 2/28/2019
584+
Purpose/Change: Update to try both http and https method if not specified for Server
582585
583586
.LINK
584587
http://labtechconsulting.com
@@ -670,7 +673,8 @@ Function Uninstall-LTService{
670673
If (-not ($Server)){
671674
$Server = Read-Host -Prompt 'Provide the URL to your LabTech server (https://lt.domain.com):'
672675
}
673-
Foreach ($Svr in $Server) {
676+
$Server=ForEach ($Svr in $Server) {$Svr; If ($Svr -notmatch 'https?://.+') {"https://$($Svr)"}}
677+
ForEach ($Svr in $Server) {
674678
If (-not ($GoodServer)) {
675679
If ($Svr -match '^(https?://)?(([12]?[0-9]{1,2}\.){3}[12]?[0-9]{1,2}|[a-z0-9][a-z0-9_-]+(\.[a-z0-9][a-z0-9_-]*)*)$') {
676680
Try{
@@ -942,7 +946,7 @@ Function Install-LTService{
942946
This will install the LabTech agent using the provided Server URL, Password, and LocationID.
943947
944948
.NOTES
945-
Version: 1.9
949+
Version: 2.0
946950
Author: Chris Taylor
947951
Website: labtechconsulting.com
948952
Creation Date: 3/14/2016
@@ -984,6 +988,9 @@ Function Install-LTService{
984988
Purpose/Change: Minor bugfixes/adjustments.
985989
Allow single label server name, accept Agent ID 1 as valid.
986990
991+
Update Date: 2/28/2019
992+
Purpose/Change: Update to try both http and https method if not specified for Server
993+
987994
.LINK
988995
http://labtechconsulting.com
989996
#>
@@ -1104,7 +1111,8 @@ Function Install-LTService{
11041111
if (-not ($TrayPort) -or -not ($TrayPort -ge 1 -and $TrayPort -le 65535)){
11051112
$TrayPort = "42000"
11061113
}
1107-
Foreach ($Svr in $Server) {
1114+
$Server=ForEach ($Svr in $Server) {$Svr; If ($Svr -notmatch 'https?://.+') {"https://$($Svr)"}}
1115+
ForEach ($Svr in $Server) {
11081116
If (-not ($GoodServer)) {
11091117
If ($Svr -match '^(https?://)?(([12]?[0-9]{1,2}\.){3}[12]?[0-9]{1,2}|[a-z0-9][a-z0-9_-]+(\.[a-z0-9][a-z0-9_-]*)*)$') {
11101118
If ($Svr -notmatch 'https?://.+') {$Svr = "http://$($Svr)"}

0 commit comments

Comments
 (0)