From a7411d1821bec14cb78bc09ee794cd7a1365ee8c Mon Sep 17 00:00:00 2001
From: Raghib <raghib2@illinois.edu>
Date: Wed, 8 Apr 2020 22:19:05 -0500
Subject: [PATCH 1/2] Updating scripts to accept dynamic file paths

---
 count-ad-objects.ps1 | 7 ++++---
 get-lens-info.ps1    | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/count-ad-objects.ps1 b/count-ad-objects.ps1
index e076a7a..971b007 100644
--- a/count-ad-objects.ps1
+++ b/count-ad-objects.ps1
@@ -2,7 +2,8 @@
 param(
 	[Parameter(Mandatory=$true)][string]$ComputerName,
 	[switch]$DebugOutput,
-	[string]$ADModuleSource
+	[string]$ADModuleSource,
+	[string]$RootDriveLetter
 )
 
 function debug($msg) {
@@ -40,8 +41,8 @@ $secpass = ConvertTo-SecureString $pass -AsPlainText -Force
 debug "Creating PSCredential object..."
 $psCreds = New-Object -typename System.Management.Automation.PSCredential -argumentlist $user, $secpass
 
-# Copy AD module files from wintools to correct locations on X:
-$dest = "x:\windows"
+# Copy AD module files from wintools to correct locations
+$dest = "$RootDriveLetter:\windows"
 robocopy /s /r:3 /w:5 $ADModuleSource $dest *.* 2>&1
 
 # Import PowerShell AD module
diff --git a/get-lens-info.ps1 b/get-lens-info.ps1
index 2ffc6bb..e619ce1 100644
--- a/get-lens-info.ps1
+++ b/get-lens-info.ps1
@@ -7,10 +7,11 @@ param(
 	# "IP" is safer because it's less likely to return multiple conflicting results
 	[string]$BasedOn="IP",
 	[string]$givenMAC=$false,
-	[string]$givenIP=$false
+	[string]$givenIP=$false,
+	[string]$LogDir
 )
 
-$log = "x:\engrit\logs\get-lens-info-script.log"
+$log = "$LogDir\get-lens-info-script.log"
 if($CalledFromTS) {
 	new-item -path $log -itemtype "file" -value "Start of log."
 }
-- 
GitLab


From 44741e4d28cc96e38190cfe4b21101d0bca9b41a Mon Sep 17 00:00:00 2001
From: Raghib <raghib2@illinois.edu>
Date: Wed, 8 Apr 2020 22:40:34 -0500
Subject: [PATCH 2/2] Fix variable reference in string

---
 count-ad-objects.ps1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/count-ad-objects.ps1 b/count-ad-objects.ps1
index 971b007..8057915 100644
--- a/count-ad-objects.ps1
+++ b/count-ad-objects.ps1
@@ -42,7 +42,7 @@ debug "Creating PSCredential object..."
 $psCreds = New-Object -typename System.Management.Automation.PSCredential -argumentlist $user, $secpass
 
 # Copy AD module files from wintools to correct locations
-$dest = "$RootDriveLetter:\windows"
+$dest = "${RootDriveLetter}:\windows"
 robocopy /s /r:3 /w:5 $ADModuleSource $dest *.* 2>&1
 
 # Import PowerShell AD module
-- 
GitLab