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"