1- Set-Location " C:\Users\mcontestabile\blahblah "
1+ Set-Location " C:\Users\mcontestabile\foo "
22
33# Determine PSVersion once
44$pv = $PSVersionTable.PSVersion
@@ -21,12 +21,14 @@ Function Start-MyCommands {
2121 try {
2222 Install-Module - Name PowerShellGet - Force - Scope CurrentUser - ErrorAction Stop
2323 } catch {
24- Write-Verbose " ⚡PowerShellGet update skipped: $ ( $_.Exception.Message ) " - ForegroundColor Green
24+ # Write-Verbose "⚡PowerShellGet update skipped: $($_.Exception.Message)" -ForegroundColor Green
25+ Write-Host (" ⚡PowerShellGet update skipped: {0}" -f $_.Exception.Message ) - ForegroundColor Green
2526 }
2627 try {
2728 Install-Module - Name PackageManagement - Force - Scope CurrentUser - ErrorAction Stop
2829 } catch {
29- Write-Verbose " ⚡PackageManagement update skipped: $ ( $_.Exception.Message ) " - ForegroundColor Yellow
30+ # Write-Verbose "⚡PackageManagement update skipped: $($_.Exception.Message)" -ForegroundColor Yellow
31+ Write-Host (" ⚡PackageManagement update skipped: {0}" -f $_.Exception.Message ) - ForegroundColor Yellow
3032 }
3133
3234 Write-Host " ⚡Ensuring AADInternals and AADInternals-Endpoints present and up to date..." - ForegroundColor Green
@@ -47,6 +49,15 @@ Function Start-MyCommands {
4749 }
4850 Import-Module - Name $m - ErrorAction Stop
4951 }
52+ # install the AD GUI+tools capability (includes ADUC)
53+ Add-WindowsCapability - Online - Name Rsat.ActiveDirectory.DS- LDS.Tools~~~~0.0 .1.0
54+
55+ # install the AD PowerShell module (if separate on your build)
56+ Add-WindowsCapability - Online - Name Rsat.AD.PowerShell~~~~0.0 .1.0
57+
58+ # load the module into the current session
59+ Import-Module ActiveDirectory
60+
5061
5162 Write-Host " ⚡Listing Active Directory Module part of RSAT..." - ForegroundColor Green
5263 Get-Module ActiveDirectory - ListAvailable
@@ -98,7 +109,8 @@ Function Start-MyCommands {
98109 Import-Module - Name $psReflectPath - ErrorAction Stop
99110 Write-Host " ⚡PSReflect loaded from $psReflectPath " - ForegroundColor Green
100111 } else {
101- Write-Warning " ⚡PSReflect module not found at $psReflectPath " - ForegroundColor Yellow
112+ # Write-Warning "⚡PSReflect module not found at $psReflectPath" -ForegroundColor Yellow
113+ Write-Host (" ⚡PSReflect module not found at: {0}" -f $psReflectPath ) - ForegroundColor Yellow
102114 }
103115
104116 # Import PowerView script by full path(dot - source.ps1 or Import-Module only for psm1 / dll)
@@ -107,7 +119,8 @@ Function Start-MyCommands {
107119 .$powerViewPath # dot - source a script to import functions into session
108120 Write-Host " ⚡PowerView dot-sourced from $powerViewPath " - ForegroundColor Green
109121 } else {
110- Write-Warning " ⚡PowerView not found at $powerViewPath " - ForegroundColor Yellow
122+ # Write-Warning "⚡PowerView not found at $powerViewPath" -ForegroundColor Yellow
123+ Write-Host (" ⚡PowerView module not found at: {0}" -f $powerViewPath ) - ForegroundColor Yellow
111124 }
112125 }else {
113126 # Any other PowerShell version
@@ -142,4 +155,4 @@ Function Start-MyCommands {
142155}
143156Start-MyCommands
144157
145- Get-Module - Name AADInternals, AADInternals- Endpoints, DSInternals, ActiveDirectory, PSPreworkout, PSReflect, PowerView - ErrorAction SilentlyContinue
158+ Get-Module - Name AADInternals, AADInternals- Endpoints, DSInternals, ActiveDirectory, PSPreworkout, PSReflect, PowerView - ErrorAction SilentlyContinue
0 commit comments