-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from scott1138/1.1.0
1.1.0
- Loading branch information
Showing
11 changed files
with
558 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$ReferenceSettings = @{ | ||
'New-SA' = @( | ||
'SandboxServiceAccountOU', | ||
'SandboxServiceAccountGroup', | ||
'DevServiceAccountOU', | ||
'DevServiceAccountGroup', | ||
'TestServiceAccountOU', | ||
'TestServiceAccountGroup', | ||
'TrainingServiceAccountOU', | ||
'TrainingServiceAccountGroup', | ||
'UATServiceAccountOU', | ||
'UATServiceAccountGroup', | ||
'ProdServiceAccountOU', | ||
'ProdServiceAccountGroup', | ||
'NoMFAGroup' | ||
) | ||
'New-User' = @( | ||
'UserOU' | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function Test-PSToolsConfig { | ||
[CmdletBinding()] | ||
|
||
param ( | ||
[Parameter(Mandatory)] | ||
[string] | ||
$Domain | ||
|
||
) | ||
|
||
# Get the name of the calling function | ||
# [0] is the current function | ||
# [1] is the calling function | ||
$FunctionName = (Get-PSCallStack)[1].Command | ||
Write-Verbose "Testing for function $FunctionName" | ||
|
||
# Check to see if the PSToolsConfig variable exists | ||
if ($null -eq $PSToolsConfig) { | ||
Write-Error 'PSToolsConfig has not been set, run Set-PSToolsConfig' | ||
break | ||
} | ||
|
||
# use the function name to check for required values. | ||
if ($FunctionName -eq 'New-SA') { | ||
# Load Reference Settings | ||
$PSToolsConfigReqsPath = "$((Get-Item $PSScriptRoot).Parent)\PSToolsConfigReqs.ps1" | ||
Write-Verbose "Loading config from $PSToolsConfigReqsPath" | ||
. $PSToolsConfigReqsPath | ||
|
||
$MissingSetting = $false | ||
foreach ($Setting in $ReferenceSettings."$FunctionName") { | ||
Write-Verbose "Checking for $Setting" | ||
if ($null -eq $PSToolsConfig."$Domain".$Setting) { | ||
Write-Warning "Missing setting $Setting for $Domain" | ||
$MissingSetting = $true | ||
} | ||
} | ||
if ($MissingSetting) { | ||
Write-Error "Missing settings required for New-SA, run Set-PSToolsConfig -Domain $Domain -Function $FunctionName" | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.