fix: indents
parent
ea0113744a
commit
5176f6c3bc
|
@ -1,29 +1,29 @@
|
||||||
#Common shared functions to handle the mods
|
#Common shared functions to handle the mods
|
||||||
|
|
||||||
function Invoke-ModsApp ($Run, $RunSwitch, $RunWait, $User) {
|
function Invoke-ModsApp ($Run, $RunSwitch, $RunWait, $User) {
|
||||||
if (Test-Path "$Run") {
|
if (Test-Path "$Run") {
|
||||||
if (!$RunSwitch) { $RunSwitch = " " }
|
if (!$RunSwitch) { $RunSwitch = " " }
|
||||||
if (!$User) {
|
if (!$User) {
|
||||||
if (!$RunWait) {
|
if (!$RunWait) {
|
||||||
Start-Process $Run -ArgumentList $RunSwitch
|
Start-Process $Run -ArgumentList $RunSwitch
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Start-Process $Run -ArgumentList $RunSwitch -Wait
|
Start-Process $Run -ArgumentList $RunSwitch -Wait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Start-Process explorer $Run
|
Start-Process explorer $Run
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Stop-ModsProc ($Proc) {
|
function Stop-ModsProc ($Proc) {
|
||||||
foreach ($process in $Proc) {
|
foreach ($process in $Proc) {
|
||||||
Stop-Process -Name $process -Force -ErrorAction SilentlyContinue | Out-Null
|
Stop-Process -Name $process -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
function Stop-ModsSvc ($Svc) {
|
function Stop-ModsSvc ($Svc) {
|
||||||
foreach ($service in $Svc) {
|
foreach ($service in $Svc) {
|
||||||
|
@ -33,232 +33,232 @@ function Stop-ModsSvc ($Svc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Wait-ModsProc ($Wait) {
|
function Wait-ModsProc ($Wait) {
|
||||||
foreach ($process in $Wait) {
|
foreach ($process in $Wait) {
|
||||||
Get-Process $process -ErrorAction SilentlyContinue | Foreach-Object { $_.WaitForExit() }
|
Get-Process $process -ErrorAction SilentlyContinue | Foreach-Object { $_.WaitForExit() }
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-WingetID ($WingetIDInst) {
|
function Install-WingetID ($WingetIDInst) {
|
||||||
foreach ($app in $WingetIDInst) {
|
foreach ($app in $WingetIDInst) {
|
||||||
& $Winget install --id $app -e --accept-package-agreements --accept-source-agreements -s winget -h
|
& $Winget install --id $app -e --accept-package-agreements --accept-source-agreements -s winget -h
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Uninstall-WingetID ($WingetIDUninst) {
|
function Uninstall-WingetID ($WingetIDUninst) {
|
||||||
foreach ($app in $WingetIDUninst) {
|
foreach ($app in $WingetIDUninst) {
|
||||||
& $Winget uninstall --id $app -e --accept-source-agreements -s winget -h
|
& $Winget uninstall --id $app -e --accept-source-agreements -s winget -h
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Uninstall-ModsApp ($AppUninst, $AllVersions) {
|
function Uninstall-ModsApp ($AppUninst, $AllVersions) {
|
||||||
foreach ($app in $AppUninst) {
|
foreach ($app in $AppUninst) {
|
||||||
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
|
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||||
foreach ($obj in $InstalledSoftware) {
|
foreach ($obj in $InstalledSoftware) {
|
||||||
if ($obj.GetValue('DisplayName') -like $App) {
|
if ($obj.GetValue('DisplayName') -like $App) {
|
||||||
$UninstallString = $obj.GetValue('UninstallString')
|
$UninstallString = $obj.GetValue('UninstallString')
|
||||||
$CleanedUninstallString = $UninstallString.Trim([char]0x0022)
|
$CleanedUninstallString = $UninstallString.Trim([char]0x0022)
|
||||||
if ($UninstallString -like "MsiExec.exe*") {
|
if ($UninstallString -like "MsiExec.exe*") {
|
||||||
$ProductCode = Select-String "{.*}" -inputobject $UninstallString
|
$ProductCode = Select-String "{.*}" -inputobject $UninstallString
|
||||||
$ProductCode = $ProductCode.matches.groups[0].value
|
$ProductCode = $ProductCode.matches.groups[0].value
|
||||||
#MSI x64 Installer
|
#MSI x64 Installer
|
||||||
$Exec = Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x$ProductCode REBOOT=R /qn" -PassThru -Wait
|
$Exec = Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x$ProductCode REBOOT=R /qn" -PassThru -Wait
|
||||||
#Stop Hard Reboot (if bad MSI!)
|
#Stop Hard Reboot (if bad MSI!)
|
||||||
if ($Exec.ExitCode -eq 1641) {
|
if ($Exec.ExitCode -eq 1641) {
|
||||||
Start-Process "C:\Windows\System32\shutdown.exe" -ArgumentList "/a"
|
Start-Process "C:\Windows\System32\shutdown.exe" -ArgumentList "/a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$QuietUninstallString = $obj.GetValue('QuietUninstallString')
|
$QuietUninstallString = $obj.GetValue('QuietUninstallString')
|
||||||
if ($QuietUninstallString) {
|
if ($QuietUninstallString) {
|
||||||
$QuietUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $QuietUninstallString
|
$QuietUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $QuietUninstallString
|
||||||
$Command = $QuietUninstallString.matches.groups[1].value
|
$Command = $QuietUninstallString.matches.groups[1].value
|
||||||
$Parameter = $QuietUninstallString.matches.groups[2].value
|
$Parameter = $QuietUninstallString.matches.groups[2].value
|
||||||
#All EXE x64 Installers (already defined silent uninstall)
|
#All EXE x64 Installers (already defined silent uninstall)
|
||||||
Start-Process $Command -ArgumentList $Parameter -Wait
|
Start-Process $Command -ArgumentList $Parameter -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((Test-Path $CleanedUninstallString)) {
|
if ((Test-Path $CleanedUninstallString)) {
|
||||||
$NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft"
|
$NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft"
|
||||||
}
|
}
|
||||||
if ($NullSoft) {
|
if ($NullSoft) {
|
||||||
#NSIS x64 Installer
|
#NSIS x64 Installer
|
||||||
Start-Process $UninstallString -ArgumentList "/S" -Wait
|
Start-Process $UninstallString -ArgumentList "/S" -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((Test-Path $CleanedUninstallString)) {
|
if ((Test-Path $CleanedUninstallString)) {
|
||||||
$Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup"
|
$Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup"
|
||||||
}
|
}
|
||||||
if ($Inno) {
|
if ($Inno) {
|
||||||
#Inno x64 Installer
|
#Inno x64 Installer
|
||||||
Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait
|
Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "x64 Uninstaller unknown, trying the UninstallString from registry..."
|
Write-Host "x64 Uninstaller unknown, trying the UninstallString from registry..."
|
||||||
$NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString
|
$NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString
|
||||||
$Command = $NativeUninstallString.matches.groups[1].value
|
$Command = $NativeUninstallString.matches.groups[1].value
|
||||||
$Parameter = $NativeUninstallString.matches.groups[2].value
|
$Parameter = $NativeUninstallString.matches.groups[2].value
|
||||||
#All EXE x64 Installers (native defined uninstall)
|
#All EXE x64 Installers (native defined uninstall)
|
||||||
Start-Process $Command -ArgumentList $Parameter -Wait
|
Start-Process $Command -ArgumentList $Parameter -Wait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$x64 = $true
|
$x64 = $true
|
||||||
if (!$AllVersions) {
|
if (!$AllVersions) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$x64) {
|
if (!$x64) {
|
||||||
$InstalledSoftware = Get-ChildItem "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
|
$InstalledSoftware = Get-ChildItem "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||||
foreach ($obj in $InstalledSoftware) {
|
foreach ($obj in $InstalledSoftware) {
|
||||||
if ($obj.GetValue('DisplayName') -like $App) {
|
if ($obj.GetValue('DisplayName') -like $App) {
|
||||||
$UninstallString = $obj.GetValue('UninstallString')
|
$UninstallString = $obj.GetValue('UninstallString')
|
||||||
$CleanedUninstallString = $UninstallString.Trim([char]0x0022)
|
$CleanedUninstallString = $UninstallString.Trim([char]0x0022)
|
||||||
if ($UninstallString -like "MsiExec.exe*") {
|
if ($UninstallString -like "MsiExec.exe*") {
|
||||||
$ProductCode = Select-String "{.*}" -inputobject $UninstallString
|
$ProductCode = Select-String "{.*}" -inputobject $UninstallString
|
||||||
$ProductCode = $ProductCode.matches.groups[0].value
|
$ProductCode = $ProductCode.matches.groups[0].value
|
||||||
#MSI x86 Installer
|
#MSI x86 Installer
|
||||||
$Exec = Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x$ProductCode REBOOT=R /qn" -PassThru -Wait
|
$Exec = Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x$ProductCode REBOOT=R /qn" -PassThru -Wait
|
||||||
#Stop Hard Reboot (if bad MSI!)
|
#Stop Hard Reboot (if bad MSI!)
|
||||||
if ($Exec.ExitCode -eq 1641) {
|
if ($Exec.ExitCode -eq 1641) {
|
||||||
Start-Process "C:\Windows\System32\shutdown.exe" -ArgumentList "/a"
|
Start-Process "C:\Windows\System32\shutdown.exe" -ArgumentList "/a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$QuietUninstallString = $obj.GetValue('QuietUninstallString')
|
$QuietUninstallString = $obj.GetValue('QuietUninstallString')
|
||||||
if ($QuietUninstallString) {
|
if ($QuietUninstallString) {
|
||||||
$QuietUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $QuietUninstallString
|
$QuietUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $QuietUninstallString
|
||||||
$Command = $QuietUninstallString.matches.groups[1].value
|
$Command = $QuietUninstallString.matches.groups[1].value
|
||||||
$Parameter = $QuietUninstallString.matches.groups[2].value
|
$Parameter = $QuietUninstallString.matches.groups[2].value
|
||||||
#All EXE x86 Installers (already defined silent uninstall)
|
#All EXE x86 Installers (already defined silent uninstall)
|
||||||
Start-Process $Command -ArgumentList $Parameter -Wait
|
Start-Process $Command -ArgumentList $Parameter -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((Test-Path $CleanedUninstallString)) {
|
if ((Test-Path $CleanedUninstallString)) {
|
||||||
$NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft"
|
$NullSoft = Select-String -Path $CleanedUninstallString -Pattern "Nullsoft"
|
||||||
}
|
}
|
||||||
if ($NullSoft) {
|
if ($NullSoft) {
|
||||||
#NSIS x86 Installer
|
#NSIS x86 Installer
|
||||||
Start-Process $UninstallString -ArgumentList "/S" -Wait
|
Start-Process $UninstallString -ArgumentList "/S" -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((Test-Path $CleanedUninstallString)) {
|
if ((Test-Path $CleanedUninstallString)) {
|
||||||
$Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup"
|
$Inno = Select-String -Path $CleanedUninstallString -Pattern "Inno Setup"
|
||||||
}
|
}
|
||||||
if ($Inno) {
|
if ($Inno) {
|
||||||
#Inno x86 Installer
|
#Inno x86 Installer
|
||||||
Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait
|
Start-Process $UninstallString -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "x86 Uninstaller unknown, trying the UninstallString from registry..."
|
Write-Host "x86 Uninstaller unknown, trying the UninstallString from registry..."
|
||||||
$NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString
|
$NativeUninstallString = Select-String "(\x22.*\x22) +(.*)" -inputobject $UninstallString
|
||||||
$Command = $NativeUninstallString.matches.groups[1].value
|
$Command = $NativeUninstallString.matches.groups[1].value
|
||||||
$Parameter = $NativeUninstallString.matches.groups[2].value
|
$Parameter = $NativeUninstallString.matches.groups[2].value
|
||||||
#All EXE x86 Installers (native defined uninstall)
|
#All EXE x86 Installers (native defined uninstall)
|
||||||
Start-Process $Command -ArgumentList $Parameter -Wait
|
Start-Process $Command -ArgumentList $Parameter -Wait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$AllVersions) {
|
if (!$AllVersions) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
function Remove-ModsLnk ($Lnk) {
|
function Remove-ModsLnk ($Lnk) {
|
||||||
foreach ($link in $Lnk) {
|
foreach ($link in $Lnk) {
|
||||||
Remove-Item -Path "${env:Public}\Desktop\$link.lnk" -Force -ErrorAction SilentlyContinue | Out-Null
|
Remove-Item -Path "${env:Public}\Desktop\$link.lnk" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) {
|
function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) {
|
||||||
if ($AddKey -like "HKEY_LOCAL_MACHINE*") {
|
if ($AddKey -like "HKEY_LOCAL_MACHINE*") {
|
||||||
$AddKey = $AddKey.replace("HKEY_LOCAL_MACHINE", "HKLM:")
|
$AddKey = $AddKey.replace("HKEY_LOCAL_MACHINE", "HKLM:")
|
||||||
}
|
}
|
||||||
if (!(Test-Path "$AddKey")) {
|
if (!(Test-Path "$AddKey")) {
|
||||||
New-Item $AddKey -Force -ErrorAction SilentlyContinue | Out-Null
|
New-Item $AddKey -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
New-ItemProperty $AddKey -Name $AddValue -Value $AddTypeData -PropertyType $AddType -Force | Out-Null
|
New-ItemProperty $AddKey -Name $AddValue -Value $AddTypeData -PropertyType $AddType -Force | Out-Null
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Remove-ModsReg ($DelKey, $DelValue) {
|
function Remove-ModsReg ($DelKey, $DelValue) {
|
||||||
if ($DelKey -like "HKEY_LOCAL_MACHINE*") {
|
if ($DelKey -like "HKEY_LOCAL_MACHINE*") {
|
||||||
$DelKey = $DelKey.replace("HKEY_LOCAL_MACHINE", "HKLM:")
|
$DelKey = $DelKey.replace("HKEY_LOCAL_MACHINE", "HKLM:")
|
||||||
}
|
}
|
||||||
if (Test-Path "$DelKey") {
|
if (Test-Path "$DelKey") {
|
||||||
if (!$DelValue) {
|
if (!$DelValue) {
|
||||||
Remove-Item $DelKey -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
|
Remove-Item $DelKey -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Remove-ItemProperty $DelKey -Name $DelValue -Force -ErrorAction SilentlyContinue | Out-Null
|
Remove-ItemProperty $DelKey -Name $DelValue -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Remove-ModsFile ($DelFile) {
|
function Remove-ModsFile ($DelFile) {
|
||||||
foreach ($file in $DelFile) {
|
foreach ($file in $DelFile) {
|
||||||
if (Test-Path "$file") {
|
if (Test-Path "$file") {
|
||||||
Remove-Item -Path $file -Force -Recurse -ErrorAction SilentlyContinue | Out-Null
|
Remove-Item -Path $file -Force -Recurse -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Rename-ModsFile ($RenFile, $NewName) {
|
function Rename-ModsFile ($RenFile, $NewName) {
|
||||||
if (Test-Path "$RenFile") {
|
if (Test-Path "$RenFile") {
|
||||||
Rename-Item -Path $RenFile -NewName $NewName -Force -ErrorAction SilentlyContinue | Out-Null
|
Rename-Item -Path $RenFile -NewName $NewName -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Copy-ModsFile ($CopyFile, $CopyTo) {
|
function Copy-ModsFile ($CopyFile, $CopyTo) {
|
||||||
if (Test-Path "$CopyFile") {
|
if (Test-Path "$CopyFile") {
|
||||||
Copy-Item -Path $CopyFile -Destination $CopyTo -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
|
Copy-Item -Path $CopyFile -Destination $CopyTo -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Edit-ModsFile ($File, $FindText, $ReplaceText) {
|
function Edit-ModsFile ($File, $FindText, $ReplaceText) {
|
||||||
if (Test-Path "$File") {
|
if (Test-Path "$File") {
|
||||||
((Get-Content -path $File -Raw) -replace "$FindText", "$ReplaceText") | Set-Content -Path $File -Force -ErrorAction SilentlyContinue | Out-Null
|
((Get-Content -path $File -Raw) -replace "$FindText", "$ReplaceText") | Set-Content -Path $File -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Grant-ModsPath ($GrantPath) {
|
function Grant-ModsPath ($GrantPath) {
|
||||||
foreach ($path in $GrantPath) {
|
foreach ($path in $GrantPath) {
|
||||||
if (Test-Path "$path") {
|
if (Test-Path "$path") {
|
||||||
$NewAcl = Get-Acl -Path $path
|
$NewAcl = Get-Acl -Path $path
|
||||||
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
||||||
if ((Get-Item $path) -is [System.IO.DirectoryInfo]) {
|
if ((Get-Item $path) -is [System.IO.DirectoryInfo]) {
|
||||||
$fileSystemAccessRuleArgumentList = $identity, 'Modify', 'ContainerInherit, ObjectInherit', 'None', 'Allow'
|
$fileSystemAccessRuleArgumentList = $identity, 'Modify', 'ContainerInherit, ObjectInherit', 'None', 'Allow'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$fileSystemAccessRuleArgumentList = $identity, 'Modify', 'Allow'
|
$fileSystemAccessRuleArgumentList = $identity, 'Modify', 'Allow'
|
||||||
}
|
}
|
||||||
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
|
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
|
||||||
$NewAcl.SetAccessRule($fileSystemAccessRule)
|
$NewAcl.SetAccessRule($fileSystemAccessRule)
|
||||||
|
|
||||||
# Grant delete permissions to subfolders and files
|
# Grant delete permissions to subfolders and files
|
||||||
$inheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
|
$inheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
|
||||||
$propagationFlag = [System.Security.AccessControl.PropagationFlags]::InheritOnly
|
$propagationFlag = [System.Security.AccessControl.PropagationFlags]::InheritOnly
|
||||||
$deleteAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $identity, 'Delete', $inheritanceFlag, $propagationFlag, 'Allow'
|
$deleteAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $identity, 'Delete', $inheritanceFlag, $propagationFlag, 'Allow'
|
||||||
$NewAcl.AddAccessRule($deleteAccessRule)
|
$NewAcl.AddAccessRule($deleteAccessRule)
|
||||||
|
|
||||||
|
|
||||||
Set-Acl -Path $path -AclObject $NewAcl
|
Set-Acl -Path $path -AclObject $NewAcl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue