Wednesday, October 14, 2015

PowerShell: Remove Windows 7 Telemetry Updates (Windows 10 Privacy Issue)

Windows 10 is violating user privacy.  Microsoft is retrieving too much personalized information about each person using Windows 10.  They've also created similar privacy violating security patches for Windows 7.  The following is a PowerShell script I created to remove the violating "security updates."

#Retrieve all Windows updates
$updates = wmic qfe list /format:csv|convertfrom-csv

#Search through update list and remove each violating update
if ($updates.hotfixid -like "*2990214*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:2990214 /norestart"}

if ($updates.hotfixid -like "*2952664*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:2952664 /norestart"}

if ($updates.hotfixid -like "*3021917*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3021917 /norestart"}

if ($updates.hotfixid -like "*3022345*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3022345 /norestart"}

if ($updates.hotfixid -like "*3035583*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3035583 /norestart"}

if ($updates.hotfixid -like "*3068708*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3068708 /norestart"}

if ($updates.hotfixid -like "*3075249*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3075249 /norestart"}

if ($updates.hotfixid -like "*3080149*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /kb:3080149 /norestart"}

#End of Script

If you want to automate the hotfix removal process, add a "/quiet" to the argumentlist.  For example: 
if ($updates.hotfixid -like "*3080149*"){start-process "c:\windows\system32\wusa.exe" -wait -nonewwindow -argumentlist "/uninstall /quiet /kb:3080149 /norestart"}

Each security update found will pop-up this first window:

Then it will prompt you to confirm the removal of the update:

Lastly, it removes the update:









After running this script, you'll need to restart your computer. Ensure to hide these updates when Windows Updater wants to add them back into your computer.

Thursday, April 16, 2015

PowerShell: Box.com Drive Mapping via DAV

Thanks to a couple of web articles I found (1,2), I'm now able to connect to my Box.com account as a drive letter.

tl;dr:
net use b: \\dav.box.com@SSL\dav /u:boxuser boxpassword

Whole script:
$password = "your embedded & encrypted Box password"

$pscred = New-Object PSCredential -ArgumentList "yourboxaccount@mail.com", ($password | ConvertTo-SecureString)

#Checking if a DAV connection exists and if not, then creating one and assigning it Drive B:

if (get-psdrive|? {$_.currentlocation -like "Your Box Root Folder\Some Box Subfolder*"}){$drive = get-psdrive|? {$_.currentlocation -like "Your Box Root Folder\Some Box Subfolder*"}|select -expandproperty root}else{net use b: \\dav.box.com@SSL\dav /u:yourboxaccount@mail.com $pscred.getnetworkcredential().Password;$drive = "B:\"}

Now you can use Robocopy instead of "Box Sync" to sync your Box.com data:
robocopy "\\server\share\content" ($drive + "Your Box Root Folder\Some Box Subfolder") /s /e /v
robocopy ($drive + "Your Box Root Folder\Some Box Subfolder") "\\server\share\content" /s /e /v