sync: auto-sync from HOWARD-HOME at 2026-05-22 09:03:36
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-05-22 09:03:36
This commit is contained in:
17
clients/cascades-tucson/scripts/new-home-folder.ps1
Normal file
17
clients/cascades-tucson/scripts/new-home-folder.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
function New-HomeFolder {
|
||||
param([string]$Username)
|
||||
$path = "D:\Homes\$Username"
|
||||
if (Test-Path $path) { Write-Host "$path already exists - check ACL manually"; return }
|
||||
New-Item -ItemType Directory -Path $path -Force | Out-Null
|
||||
$acl = New-Object System.Security.AccessControl.DirectorySecurity
|
||||
$acl.SetAccessRuleProtection($true, $false)
|
||||
$acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("CASCADES\$Username","FullControl","ContainerInherit,ObjectInherit","None","Allow")))
|
||||
$acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("SYSTEM","FullControl","ContainerInherit,ObjectInherit","None","Allow")))
|
||||
$acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("BUILTIN\Administrators","FullControl","ContainerInherit,ObjectInherit","None","Allow")))
|
||||
Set-Acl $path $acl
|
||||
Write-Host "$path created with clean ACL"
|
||||
}
|
||||
|
||||
# Usage: dot-source this file, then call:
|
||||
# New-HomeFolder -Username "lauren.hasselman"
|
||||
# Run on CS-SERVER before adding user to SG-FolderRedirect.
|
||||
Reference in New Issue
Block a user