Netsweeper Filtering – Stop clients getting unfiltered internet access if the client software is not installed
When using the Netsweeper client there could be a point in which the machine is being used but the client filter software has not been installed either manually or via GPO. This can be resolved easily with the use of a quick PowerShell user logon script rolled out via a GPO that checks for the presence of the Netsweeper NSFXSrvDivert service and sets a false proxy if the service is Stopped or not installed.
<# .DESCRIPTION Checks for the presence of the Netsweeper NSFXSrvDivert service and sets a false proxy if the service is Stopped or not installed .NOTES FileName: HTTPBackstop.ps1 Author: Dan Rhodes Created: 14/12/2020 Version: 1.1 - 16/12/2020 .CHANGELOG 1.1 - 16/12/2020 - Changed the order of setting the proxy and the wanring message so proxy is set first in case the user doesnt click ok the script would block the proxy #> [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $Message = New-Object -comobject "WScript.Shell" $ServiceName = 'NSFXSrvDivert' $nullproxy = 'proxy.to.nowhere.local' $regKey="HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $Computername = (Get-Item env:\Computername).Value If (Get-Service $serviceName -ErrorAction SilentlyContinue) { If ((Get-Service $serviceName).Status -ne 'Running') { Set-ItemProperty -path $regKey ProxyEnable -value 1 Set-ItemProperty -path $regKey ProxyServer -value $nullproxy $Message.popup("NetSweeper $serviceName service found, but it is not running, this device's Internet access will be blocked, please reboot this machine to resolve the issue, if this does not work contact IT Support and quote computer name $Computername...",0,"Netsweeper service not running") } else { Set-ItemProperty -path $regKey ProxyEnable -value 0 } } else { Set-ItemProperty -path $regKey ProxyEnable -value 1 Set-ItemProperty -path $regKey ProxyServer -value $nullproxy $Message.popup("NetSweeper $serviceName service not found, this device's Internet access will be blocked, please reboot this machine up to three times, if this does not work contact IT Support and quote computer name $Computername...",0,"Netsweeper service not found") }