diff --git a/File-Management-Scripts/Convert-Csv-To-Xlsx.ps1 b/File-Management-Scripts/Convert-Csv-To-Xlsx.ps1 index e17009c..203a0d4 100644 --- a/File-Management-Scripts/Convert-Csv-To-Xlsx.ps1 +++ b/File-Management-Scripts/Convert-Csv-To-Xlsx.ps1 @@ -1,7 +1,12 @@ # ConvertCsvToXlsx.ps1 +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + # Define the folder to monitor -$watchFolder = 'C:\Users\jason.lamb\OneDrive - middough\Downloads\csv2xlsx' +$watchFolder = "$onedrivepath\Downloads\csv2xlsx" $processedFolder = Join-Path $watchFolder 'Processed' # Ensure the processed folder exists diff --git a/File-Management-Scripts/compare-source-destination-files.ps1 b/File-Management-Scripts/compare-source-destination-files.ps1 index 710e565..20655e8 100644 --- a/File-Management-Scripts/compare-source-destination-files.ps1 +++ b/File-Management-Scripts/compare-source-destination-files.ps1 @@ -4,9 +4,14 @@ # Created Date : 2025-09-04 # Modified Date : 2025-09-04 +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + param( [string] $SourceFile = 'S:\Corporate\MIS\Project List Download.xlsx', - [string] $DestFolder = 'C:\Users\jason.lamb\OneDrive - middough\General - IT\U & N Drive clean up', + [string] $DestFolder = "$onedrivepath\General - IT\U & N Drive clean up", [string] $BaseName = 'Project List Download', # filename prefix before the date [string] $SearchMask = 'Project List Download*.xlsx' # existing destination pattern ) diff --git a/File-Management-Scripts/compare-two-xlsx-files.ps1 b/File-Management-Scripts/compare-two-xlsx-files.ps1 index 807066a..f376c35 100644 --- a/File-Management-Scripts/compare-two-xlsx-files.ps1 +++ b/File-Management-Scripts/compare-two-xlsx-files.ps1 @@ -5,9 +5,14 @@ # Created Date : 2025-09-04 # Modified Date : 2025-09-04 +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + param( # Where your dated project list XLSX files live - [string] $Folder = 'C:\Users\jason.lamb\OneDrive - middough\General - IT\U & N Drive clean up', + [string] $Folder = "$onedrivepath\General - IT\U & N Drive clean up", # Pattern to match the dated files (e.g., "Project List Download 090425.xlsx") [string] $SearchMask = 'Project List Download*.xlsx', diff --git a/HEIC-Convert-To-JPG/convert-png-to-ico.ps1 b/HEIC-Convert-To-JPG/convert-png-to-ico.ps1 index 1e96cad..5218d1a 100644 --- a/HEIC-Convert-To-JPG/convert-png-to-ico.ps1 +++ b/HEIC-Convert-To-JPG/convert-png-to-ico.ps1 @@ -78,11 +78,16 @@ function Convert-PngToMultiResIco { } -Convert-PngToMultiResIco -PngPath "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell\HEIC-Convert-To-JPG\icon.png" +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + +Convert-PngToMultiResIco -PngPath "$onedrivepath\Documents\GitHub\PowerShell\HEIC-Convert-To-JPG\icon.png" <# -$pngPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell\HEIC-Convert-To-JPG\icon.png" +$pngPath = "$onedrivepath\Documents\GitHub\PowerShell\HEIC-Convert-To-JPG\icon.png" if (Test-Path $pngPath) { Write-Host "✅ File exists : $pngPath" diff --git a/Miscellaneous/Create-Csv-To-Xlsx-Task.ps1 b/Miscellaneous/Create-Csv-To-Xlsx-Task.ps1 index b53ce3f..5c9d8d1 100644 --- a/Miscellaneous/Create-Csv-To-Xlsx-Task.ps1 +++ b/Miscellaneous/Create-Csv-To-Xlsx-Task.ps1 @@ -1,7 +1,12 @@ # CreateCsvToXlsxTask.ps1 +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + # Define the path to the PowerShell script -$scriptPath = 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell\Miscellaneous\ConvertCsvToXlsx.ps1' +$scriptPath = "$onedrivepath\Documents\GitHub\PowerShell\Miscellaneous\ConvertCsvToXlsx.ps1" # Define the action to execute the PowerShell script $action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" diff --git a/Miscellaneous/ps-common-profile-COPY.ps1 b/Miscellaneous/ps-common-profile-COPY.ps1 index 102bcd0..e4cf2a6 100644 --- a/Miscellaneous/ps-common-profile-COPY.ps1 +++ b/Miscellaneous/ps-common-profile-COPY.ps1 @@ -4,7 +4,7 @@ function Start-CustomTranscript { $username = $env:USERNAME $hostname = $env:COMPUTERNAME $timestamp = (Get-Date).ToString("yyyyMMdd_HHmmss") - $transcriptDir = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell Transcript" + $transcriptDir = "$onedrivepath\Documents\GitHub\PowerShell Transcript" $transcriptPath = "$transcriptDir\PStranscript-$hostname-$username-$timestamp.txt" if (!(Test-Path $transcriptDir)) { @@ -42,7 +42,7 @@ if ($profileContent -notmatch 'Import-Module\s+Terminal-Icons') { # Load credentials from the file for each computer # Construct the path to the credential file based on the computer name -$credPath = Join-Path -Path "C:\users\jason.lamb\OneDrive - middough\Documents\GitHub" -ChildPath "admincred-$env:COMPUTERNAME.xml" +$credPath = Join-Path -Path "$onedrivepath\Documents\GitHub" -ChildPath "admincred-$env:COMPUTERNAME.xml" # Check if the credential file exists if (Test-Path $credPath) { @@ -56,10 +56,10 @@ if (Test-Path $credPath) { } else { Write-Warning "Credential file not found: $credPath" Write-Warning "ENTER ADM CREDENTIALS" -#. "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\set-save-admincred-per-computer.ps1" +#. "$onedrivepath\Documents\GitHub\set-save-admincred-per-computer.ps1" } -# $admincred = Import-Clixml -Path "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\admincred.xml" +# $admincred = Import-Clixml -Path "$onedrivepath\Documents\GitHub\admincred.xml" #################### @@ -73,7 +73,7 @@ Write-Warning "ENTER ADM CREDENTIALS" function Git-PowerShell-Private-Sync { - $repoPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell-Private" + $repoPath = "$onedrivepath\Documents\GitHub\PowerShell-Private" #START RENAME FILES WITH SPACES TO DASHES - PRIVATE @@ -165,7 +165,7 @@ if ($trackedChanges) { function Git-PowerShell-Sync { param() - $repoPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell" + $repoPath = "$onedrivepath\Documents\GitHub\PowerShell" $datetime = Get-Date -Format 'yyyy-MM-dd HH:mm:ss' if (-not (Test-Path -LiteralPath $repoPath)) { @@ -266,7 +266,7 @@ function Git-PowerShell-Sync { function Git-Commit-PowerShell-Private { - $repoPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell-Private" + $repoPath = "$onedrivepath\Documents\GitHub\PowerShell-Private" $datetime = Get-Date -Format 'yyyy-MM-dd HH:mm:ss' if (-not (Test-Path -LiteralPath $repoPath)) { @@ -352,7 +352,7 @@ function Git-Commit-PowerShell-Private { #################### function Git-Commit-PowerShell { - $repoPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell" + $repoPath = "$onedrivepath\Documents\GitHub\PowerShell" #START RENAME FILES WITH SPACES TO DASHES @@ -433,7 +433,7 @@ if ($trackedChanges) { ################### function Git-jasrasr-Sync { - $repoPath = "C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\jasrasr.github.io" + $repoPath = "$onedrivepath\Documents\GitHub\jasrasr.github.io" #START RENAME FILES WITH SPACES TO DASHES @@ -509,7 +509,7 @@ Set-Alias jlgjs Git-jasrasr-Sync #################### -import-module 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell-Private\MyCustomModule\mycustommodule.psm1' +import-module '$onedrivepath\Documents\GitHub\PowerShell-Private\MyCustomModule\mycustommodule.psm1' #################### @@ -901,7 +901,7 @@ $clesccm = '\\clesccm\e$\application source\cad applications' $middlocal = '\\middough.local\corp\data' #Function np { & 'C:\Program Files (x86)\Notepad++\notepad++.exe' @args } #Function notepadnew { & 'C:\Windows\System32\notepad.exe' @args } -$psexec = "C:\Users\jason.lamb\OneDrive - middough\Github\PsExec" +$psexec = "$onedrivepath\Github\PsExec" $domain = "middough" #${domain} for no space $domainup = "Middough" #${domain} for no space $username = "jason.lamb" #${username} for no space @@ -1149,7 +1149,7 @@ function Track-Package { ###################### -. 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\!PS-custom-faq-help.ps1' +. '$onedrivepath\Documents\GitHub\!PS-custom-faq-help.ps1' ###################### @@ -1180,7 +1180,7 @@ function dell { # https://www.dell.com/support/home/en-us/product-support/servicetag/7QBMYK3 # launches chrome in new window -#. 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell-Private\File-Management-Scripts\compare-source-destination-files-and-csv-export-diff.ps1' +#. '$onedrivepath\Documents\GitHub\PowerShell-Private\File-Management-Scripts\compare-source-destination-files-and-csv-export-diff.ps1' ###################### @@ -1234,10 +1234,10 @@ if ($last -ne $today) { # ===== Your once-per-day steps ===== try { # 1) Security Now! fetch - & 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell\GRC-TWIT-SecurityNow-Transcripts\download-next-security-now-txt-transcriptions-and-pdf-show-notes-from-grc_com.ps1' + & '$onedrivepath\Documents\GitHub\PowerShell\GRC-TWIT-SecurityNow-Transcripts\download-next-security-now-txt-transcriptions-and-pdf-show-notes-from-grc_com.ps1' # 2) File compare + CSV diff - & 'C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\PowerShell-Private\File-Management-Scripts\compare-source-destination-files-and-csv-export-diff.ps1' + & '$onedrivepath\Documents\GitHub\PowerShell-Private\File-Management-Scripts\compare-source-destination-files-and-csv-export-diff.ps1' # 3) Git sync function jlgps2 diff --git a/Miscellaneous/ps-custom-faq-help-COPY.ps1 b/Miscellaneous/ps-custom-faq-help-COPY.ps1 index bda2038..08ce2a5 100644 --- a/Miscellaneous/ps-custom-faq-help-COPY.ps1 +++ b/Miscellaneous/ps-custom-faq-help-COPY.ps1 @@ -4,6 +4,11 @@ # Created Date : 2025-08-19 # Modified Date : Auto-updates when reloaded +# Need to define $onedrivepath variable if not already defined +if (-not $onedrivepath) { + $onedrivepath = 'C:\users\jason.lamb\OneDrive - middough' +} + $Revision = '1.5' $CreatedDate = '2025-08-19' $ModifiedDate = (Get-Date).ToString('yyyy-MM-dd') @@ -23,7 +28,7 @@ function Show-JasonHelp { # --- Help Text --- $helpText = @" # FAQ File Location -C:\Users\jason.lamb\OneDrive - middough\Documents\GitHub\!PS-custom-faq-help.ps1 +$onedrivepath\Documents\GitHub\!PS-custom-faq-help.ps1 # Common Paths C:\temp\powershell-exports\