This commit is contained in:
Zack Meier
2026-04-15 15:42:41 -05:00
parent 74edcc4d9a
commit 03dba08135
146 changed files with 9119 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
try
{
$Filter = "(samaccountname=$env:username)"
$RootOU = "dc=nd,dc=gov"
Write-Warning $Filter
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = $Filter
$result=$Searcher.FindAll()
$homedir = $result.properties.homedirectory
$homedrive = $result.properties.homedrive
$ScriptPath = $result.properties.scriptpath
Write-Warning ("HomeDirectory: " + $homedir )
Write-Warning ("HomeDrive: " + $homedrive)
If($homedrive)
{
New-PSDrive -Name $homedrive.TrimEnd(':') -PSProvider FileSystem -Root $homedir -Persist
}
If($ScriptPath)
{
Write-Warning ("ScriptPath: " + $ScriptPath)
$LoginScript = "\\nd.gov\netlogon\$ScriptPath"
Start-Process "cmd.exe" "/c $loginscript" #<< run loginscript
}
}
catch
{
New-Item -Path "$env:userprofile\Desktop\MapDrivesError.txt"
$error | Set-Content .\MapDrivesError.txt
}
Read-Host -Prompt "Press Enter to complete"