add scripts to prevent family safety monitoring
This commit is contained in:
@@ -1267,6 +1267,32 @@ actions:
|
||||
docs: https://www.tenforums.com/tutorials/4077-turn-off-sync-settings-microsoft-account-windows-10-a.html
|
||||
code: reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language" /t REG_DWORD /v "Enabled" /d 0 /f
|
||||
revertCode: reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language" /t REG_DWORD /v "Enabled" /d 1 /f
|
||||
-
|
||||
category: Prevent Microsoft family safety monitoring
|
||||
children:
|
||||
-
|
||||
name: Disable Microsoft Family Safety Monitor
|
||||
recommend: standard
|
||||
code: |-
|
||||
schtasks /change /disable /tn "Microsoft\Windows\Shell\FamilySafetyMonitor"
|
||||
schtasks /change /disable /tn "Microsoft\Windows\Shell\FamilySafetyRefresh"
|
||||
schtasks /change /disable /tn "Microsoft\Windows\Shell\FamilySafetyUpload"
|
||||
revertCode: |-
|
||||
schtasks /change /enable /tn "Microsoft\Windows\Shell\FamilySafetyMonitor"
|
||||
schtasks /change /enable /tn "Microsoft\Windows\Shell\FamilySafetyRefresh"
|
||||
schtasks /change /enable /tn "Microsoft\Windows\Shell\FamilySafetyUpload"
|
||||
-
|
||||
name: Uninstall Microsoft Family Safety Monitor
|
||||
recommend: strict
|
||||
call:
|
||||
-
|
||||
function: RenameSystemFile
|
||||
parameters:
|
||||
filePath: '%SystemRoot%\System32\WpcTok.exe'
|
||||
-
|
||||
function: RenameSystemFile
|
||||
parameters:
|
||||
filePath: '%SystemRoot%\System32\WpcMon.exe'
|
||||
-
|
||||
category: Configure programs
|
||||
children:
|
||||
@@ -4078,3 +4104,24 @@ functions:
|
||||
parameters: [ capabilityName ]
|
||||
code: PowerShell -Command "Get-WindowsCapability -Online -Name '{{ $capabilityName }}*'' | Remove-WindowsCapability -Online"
|
||||
revertCode: PowerShell -Command "$capability = Get-WindowsCapability -Online -Name '{{ $capabilityName }}*''; Add-WindowsCapability -Name \"$capability.Name\" -Online"
|
||||
-
|
||||
name: RenameSystemFile
|
||||
parameters: [ filePath ]
|
||||
code: |-
|
||||
if exist "{{ $filePath }}" (
|
||||
takeown /f "{{ $filePath }}"
|
||||
icacls "{{ $filePath }}" /grant administrators:F
|
||||
move "{{ $filePath }}" "{{ $filePath }}.OLD"
|
||||
echo Moved "{{ $filePath }}" to "{{ $filePath }}.OLD"
|
||||
) else (
|
||||
echo No action required: {{ $filePath }} is not found.
|
||||
)
|
||||
revertCode: |-
|
||||
if exist "{{ $filePath }}.OLD" (
|
||||
takeown /f "{{ $filePath }}.OLD"
|
||||
icacls "{{ $filePath }}.OLD" /grant administrators:F
|
||||
move "{{ $filePath }}.OLD" "{{ $filePath }}"
|
||||
echo Moved "{{ $filePath }}.OLD" to "{{ $filePath }}"
|
||||
) else (
|
||||
echo Could not find backup file "{{ $filePath }}.OLD" 1>&2
|
||||
)
|
||||
|
||||
@@ -23,19 +23,19 @@ function validateCode(name: string, code: string): void {
|
||||
if (!code || code.length === 0) {
|
||||
throw new Error(`code of ${name} is empty or undefined`);
|
||||
}
|
||||
ensureCodeHasUniqueLines(name, code);
|
||||
ensureNoEmptyLines(name, code);
|
||||
ensureCodeHasUniqueLines(name, code);
|
||||
}
|
||||
|
||||
function ensureNoEmptyLines(name: string, code: string): void {
|
||||
if (code.split('\n').some((line) => line.trim().length === 0)) {
|
||||
throw Error(`Script has empty lines "${name}"`);
|
||||
throw Error(`script has empty lines "${name}"`);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureCodeHasUniqueLines(name: string, code: string): void {
|
||||
const lines = code.split('\n')
|
||||
.filter((line) => mayBeUniqueLine(line));
|
||||
.filter((line) => !shouldIgnoreLine(line));
|
||||
if (lines.length === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -45,13 +45,13 @@ function ensureCodeHasUniqueLines(name: string, code: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
function mayBeUniqueLine(codeLine: string): boolean {
|
||||
const trimmed = codeLine.trim();
|
||||
if (trimmed === ')' || trimmed === '(') { // "(" and ")" are used often in batch code
|
||||
return false;
|
||||
}
|
||||
if (codeLine.startsWith(':: ') || codeLine.startsWith('REM ')) { // Is comment?
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
function shouldIgnoreLine(codeLine: string): boolean {
|
||||
codeLine = codeLine.toLowerCase();
|
||||
const isCommentLine = () => codeLine.startsWith(':: ') || codeLine.startsWith('rem ');
|
||||
const consistsOfFrequentCommands = () => {
|
||||
const frequentCodeParts = [ '(', ')', 'else' ];
|
||||
const trimmed = codeLine.trim().split(' ');
|
||||
return trimmed.every((part) => frequentCodeParts.includes(part));
|
||||
};
|
||||
return isCommentLine() || consistsOfFrequentCommands();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user