Apply local lock policy during enrollment
This commit is contained in:
1 parent
fd051dee80
commit
ba2aca5c2a
12 files changed
+469
-7
No files matched your search
@@ -1,5 +1,6 @@
|
||||
$repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$localUserScriptPath = Join-Path $repositoryRoot 'scripts\Set-SguStandardLocalUser.ps1'
|
||||
$localProfilePolicyScriptPath = Join-Path $repositoryRoot 'scripts\Set-SguLocalProfileSecurityPolicies.ps1'
|
||||
$enrollmentTestScriptPath = Join-Path $repositoryRoot 'scripts\Test-SguClientEnrollment.ps1'
|
||||
$packageScriptPath = Join-Path $repositoryRoot 'scripts\New-SguBootstrapPackages.ps1'
|
||||
$releaseScriptPath = Join-Path $repositoryRoot 'scripts\Publish-GiteaRelease.ps1'
|
||||
@@ -17,6 +18,16 @@ if ($parseErrors.Count -gt 0) {
|
||||
throw ($parseErrors -join [Environment]::NewLine)
|
||||
}
|
||||
|
||||
$localProfilePolicyTokens = $null
|
||||
$localProfilePolicyParseErrors = $null
|
||||
[void][Management.Automation.Language.Parser]::ParseFile(
|
||||
$localProfilePolicyScriptPath,
|
||||
[ref]$localProfilePolicyTokens,
|
||||
[ref]$localProfilePolicyParseErrors)
|
||||
if ($localProfilePolicyParseErrors.Count -gt 0) {
|
||||
throw ($localProfilePolicyParseErrors -join [Environment]::NewLine)
|
||||
}
|
||||
|
||||
$descriptionAssignment = $scriptAst.Find({
|
||||
param($node)
|
||||
$node -is [Management.Automation.Language.AssignmentStatementAst] -and
|
||||
@@ -55,6 +66,23 @@ Describe 'SGU Windows client enrollment scripts' {
|
||||
}).Count | Should Be 0
|
||||
}
|
||||
|
||||
It 'applies DisableLockWorkstation to existing and future local users during enrollment' {
|
||||
$localUserSource = Get-Content -LiteralPath $localUserScriptPath -Raw
|
||||
$profilePolicySource = Get-Content -LiteralPath $localProfilePolicyScriptPath -Raw
|
||||
$enrollmentSource = Get-Content -LiteralPath (Join-Path $repositoryRoot 'scripts\Enroll-SguDomainClient.ps1') -Raw
|
||||
$packageSource = Get-Content -LiteralPath $packageScriptPath -Raw
|
||||
|
||||
$localUserSource | Should Match 'Set-SguLocalProfileSecurityPolicies\.ps1'
|
||||
$profilePolicySource | Should Match "\$policyValueName = 'DisableLockWorkstation'"
|
||||
$profilePolicySource | Should Match 'Get-LocalUser'
|
||||
$profilePolicySource | Should Match 'NTUSER\.DAT'
|
||||
$profilePolicySource | Should Match "-UserId 'SYSTEM'"
|
||||
$profilePolicySource | Should Match 'Unregister-ScheduledTask'
|
||||
$profilePolicySource | Should Match 'DefaultProfileConfigured'
|
||||
$enrollmentSource | Should Match "'Set-SguLocalProfileSecurityPolicies\.ps1'"
|
||||
$packageSource | Should Match "'Set-SguLocalProfileSecurityPolicies\.ps1'"
|
||||
}
|
||||
|
||||
It 'publishes one Windows artifact with automatic compatibility' {
|
||||
$packageSource = Get-Content -LiteralPath $packageScriptPath -Raw
|
||||
$releaseSource = Get-Content -LiteralPath $releaseScriptPath -Raw
|
||||
|
||||
Reference in new issue
Block a user