Deleted Remove Permissions Script (Does not Work)
This commit is contained in:
parent
22bc7e4d05
commit
cfba974a45
@ -1,22 +0,0 @@
|
|||||||
$folderPath = "C:\Scripts"
|
|
||||||
$groupName = "NT AUTHORITY\Authenticated Users"
|
|
||||||
|
|
||||||
# Get current ACL
|
|
||||||
$acl = Get-Acl -Path $folderPath
|
|
||||||
|
|
||||||
# Create a new FileSystemSecurity object
|
|
||||||
$newAcl = New-Object System.Security.AccessControl.DirectorySecurity
|
|
||||||
|
|
||||||
# Disable inheritance and copy existing rules
|
|
||||||
$newAcl.SetAccessRuleProtection($true, $true)
|
|
||||||
|
|
||||||
# Get all rules except Authenticated Users
|
|
||||||
$rules = $acl.Access | Where-Object {$_.IdentityReference -ne $groupName}
|
|
||||||
|
|
||||||
# Add each rule to the new ACL
|
|
||||||
foreach ($rule in $rules) {
|
|
||||||
$newAcl.AddAccessRule($rule)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Apply the modified ACL back to the folder
|
|
||||||
Set-Acl -Path $folderPath -AclObject $newAcl
|
|
||||||
@ -91,10 +91,6 @@ powershell Remove-Item -Path 'C:\Scripts\Software\Office2016' -Recurse -Force
|
|||||||
powershell Remove-Item -Path 'C:\Scripts\Software\RemoteAgent64-TCSE.exe'
|
powershell Remove-Item -Path 'C:\Scripts\Software\RemoteAgent64-TCSE.exe'
|
||||||
powershell Remove-Item -Path 'C:\Scripts\Software\gcpwstandaloneenterprise64.exe'
|
powershell Remove-Item -Path 'C:\Scripts\Software\gcpwstandaloneenterprise64.exe'
|
||||||
|
|
||||||
:: Remove Permissions
|
|
||||||
echo Removing User Permissions to Scripts Folder...
|
|
||||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Remove-Permissions.ps1"
|
|
||||||
|
|
||||||
:: Perform Windows Updates
|
:: Perform Windows Updates
|
||||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
|
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user