2022-06-22

Block an Application from accessing Internet with Windows Firewall

 

$ProgramName = 'ProgramName';
$ProgramPaths = @();
$ProgramPaths += "$env:ProgramFiles\ProgramName";

$BlockIPs = @("1.0.0.0-9.255.255.255", "11.0.0.0-126.255.255.255", "128.0.0.0-172.15.255.255", "172.33.0.0-192.167.255.255", "192.169.0.0-255.255.255.255")

#----------------------------------------------------------

$Remove = New-NetFirewallRule -DisplayName "RemovePrepare" -Group ($ProgramName + 'Block') -Direction Outbound -Program "C:\windows\system32\calc.exe" -Action Block -RemoteAddress $BlockIPs;
Remove-NetFirewallRule -Group ($ProgramName + 'Block') -Confirm:$False;

$ProgramEXEFile = @();
foreach ($ProgramPath in $ProgramPaths) {
$ProgramEXEFile += Get-ChildItem $ProgramPath -Recurse | where {$_.extension -eq ".exe"};
};

2022-06-14

用 GPO 允許 User 安裝印表機驅動程式的設定

GPO

Computer Configuration
- Policies
- Windows Settings
- Security Settings
- Local Policies
- User Rights Assignment
- Load and unload device drivers 

Domain Users

Computer Configuration
- Policies
- Windows Settings
- Security Settings
- Local Policies
- Security Options
- Devices: Prevent users from installing printer drivers 

Disable

 Computer Configuration
- Policies
- Administrative Templates
- System/Device Installation/Device Installation Restrictions
- Allow installation of devices using drivers that match these device setup classes 

Computer Configuration
- Policies
- Administrative Templates
- System/Driver Installation
- Allow non-administrators to install drivers for these device setup classes

上面這兩個設定中原本只有以下這兩個:
{4658ee7e-f050-11d1-b6bd-00c04fa372a7}
{4d36e979-e325-11ce-bfc1-08002be10318}

Windows 10 & Windows 11 會一直出現 Driver is unavailable
查到還要再加下面這個就正常了: