Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .net-string-methods.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ $string.Length # Number of characters
"one,two,three".Split(",") # → array: "one" "two" "three"
@("one", "two") -join "|" # → "one|two"

# File path helpers
# File path manipulation using System.IO.Path methods
# File path helpers if $path = "C:\folder\file.txt"
$path = "C:\folder\file.txt"
[System.IO.Path]::GetFileName($path) # "file.txt"
[System.IO.Path]::GetDirectoryName($path) # "C:\folder"
[System.IO.Path]::GetExtension($path) # ".txt"
[System.IO.Path]::ChangeExtension($path, ".bak") # Change file extension
[System.IO.Path]::ChangeExtension($path, ".bak") # C:\folder\file.bak - Change file extension



# Practical examples
" jason.lamb ".Trim().ToUpper() # "JASON.LAMB"
"first.last".Trim().ToUpper() # "FIRST.LAST"
"report-2025.pdf".Replace("2025","2026") # "report-2026.pdf"
"one,two,three".Split(",") # "one","two","three"
@("x", "y", "z") -join ";" # "x;y;z"
4 changes: 2 additions & 2 deletions AD-Scripts/ad-audit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ param(

# === CONFIGURABLE ===
# Only this DC will be queried. Change when needed.
$DomainController = 'CLEDC1'
$DomainController = 'SERVERNAME' # e.g. 'DC1', 'dc01.corp.local', etc.

# Output location
$OutDir = 'C:\temp\powershell-exports'
$OutDir = $psexports
if (-not (Test-Path $OutDir)) { New-Item -Path $OutDir -ItemType Directory | Out-Null }
$Stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
$OutFile = Join-Path $OutDir "ad-reactivation-audit-$($DomainController)-$Stamp.csv"
Expand Down
4 changes: 2 additions & 2 deletions AutoCAD/autopurge.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Paths
$coreConsolePath = "C:\Program Files\Autodesk\AutoCAD 2026\accoreconsole.exe"
$scriptFile = "C:\Temp\193-Scrubber-Oil\autopurge.scr"
$dwgFull = "C:\Temp\193-Scrubber-Oil\193-P-1908.dwg"
$scriptFile = "C:\folder\autopurge.scr"
$dwgFull = "C:\folder\file.dwg"

Write-Host "Purging file: $dwgFull" -ForegroundColor Cyan

Expand Down
6 changes: 6 additions & 0 deletions AutoCAD/autopurge.scr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; start script
_OPEN "C:\folder\file.dwg"
-PURGE ALL *
AUDIT N
_SAVE
_CLOSE
Loading