interanl flag detection
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
$flagFile = "C:\ProgramData\PrinterHKeyClean\v1.flag"
|
||||||
|
|
||||||
|
if (Test-Path $flagFile) {
|
||||||
|
Write-Host "Script has already run. Exiting."
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
$profileListKey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'
|
$profileListKey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'
|
||||||
|
|
||||||
$sids = Get-ChildItem $profileListKey
|
$sids = Get-ChildItem $profileListKey
|
||||||
@@ -48,4 +55,4 @@ net start spooler
|
|||||||
|
|
||||||
gpupdate /force
|
gpupdate /force
|
||||||
|
|
||||||
New-Item -Path "C:\ProgramData\PrinterHKeyClean\v1.flag" -ItemType File -Force
|
New-Item -Path $flagFile -ItemType File -Force
|
||||||
|
|||||||
Reference in New Issue
Block a user