update pre-commit; add some more hooks (#8492)

* update pre-commit; add some more hooks

* Apply suggestions from code review
This commit is contained in:
skshetry
2022-10-31 21:04:11 +05:45
committed by GitHub
parent 4ca2158b9d
commit 6df70d388e
15 changed files with 69 additions and 46 deletions
+5 -5
View File
@@ -24,8 +24,8 @@ function addSymLinkPermissions($accountToAdd){
Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan
$tmp = [System.IO.Path]::GetTempFileName()
Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan
secedit.exe /export /cfg "$($tmp)"
$c = Get-Content -Path $tmp
secedit.exe /export /cfg "$($tmp)"
$c = Get-Content -Path $tmp
$currentSetting = ""
foreach($s in $c) {
if( $s -like "SECreateSymbolicLinkPrivilege*") {
@@ -35,7 +35,7 @@ function addSymLinkPermissions($accountToAdd){
}
if( $currentSetting -notlike "*$($sidstr)*" ) {
Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow
Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan
if( [string]::IsNullOrEmpty($currentSetting) ) {
@@ -58,8 +58,8 @@ SECreateSymbolicLinkPrivilege = $($currentSetting)
$outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force
Push-Location (Split-Path $tmp2)
try {
secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS
} finally {
secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS
} finally {
Pop-Location
}
} else {