Removed User Permissions to Scripts Folder
This commit is contained in:
parent
5f133e5cb1
commit
077bd02831
10
Patches/Windows/Remove-Permissions.ps1
Normal file
10
Patches/Windows/Remove-Permissions.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
$computerName = $env:COMPUTERNAME
|
||||
$domain = (Get-WmiObject Win32_ComputerSystem).Domain
|
||||
|
||||
$folderPath = "C:\Scripts"
|
||||
$groupName = "Authenticated Users"
|
||||
|
||||
$acl = Get-Acl -Path $folderPath
|
||||
$acl.SetAccessRuleProtection($true, $false)
|
||||
$acl.RemoveAccessRule($acl.Access | Where-Object {$_.IdentityReference -eq "$domain\$groupName"})
|
||||
Set-Acl -Path $folderPath -AclObject $acl
|
||||
@ -91,6 +91,10 @@ 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\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
|
||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user