Sunday, February 11, 2024

Stop Windows 10/11 from searching ZIP and CAB files

https://www.thewindowsclub.com/disable-windows-built-in-zip
https://www.thewindowsclub.com/how-to-take-full-control-of-windows-7-registry-keys
https://www.thewindowsclub.com/regownit-take-full-control-windows-registry-keys

Following up on a post from 6/3/2011, the uninstall entrypoint has been removed from zipfldr.dll and cabview.dll in Windows 10/11 so the regsvr32 commands do not work.

However, setting the "Attributes"  registry values to zero in the following keys still works:
HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}\ShellFolder HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}\ShellFolder (Note: You may have to copy and paste these keys to see them.)

In order to change these you will likely need to assume/set ownership of the ShellFolder keys and also change user permissions, as the defaults for these keys are owners being TrustedInstaller for the 1st and SYSTEM for the 2nd, with Read-Only access for all users. Refer to the links above to adjust permissions of Windows registry keys.

Sunday, January 21, 2024

Exclude paths from Windows 7 backup

 https://kb.synology.com/en-id/C2/tutorial/How_do_I_exclude_files_and_folders_from_backups
 https://learn.microsoft.com/en-us/windows/win32/vss/excluding-files-from-shadow-copies

To exclude files / folders / paths from Windows 7 backup:

1) In Regedit.exe, navigate to the following regkey.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot
2) Create a new MULTI_SZ regval called anything descriptive, or such as, "Excluded-20240121".
3) Double-click the new regval to open it, and add the full file path of the file name, folder name, or wildcard you want excluded.
4) Add multiple paths to the regval, or repeat with additional regvals as necessary.

This regkey should already exist and contain default values for various commercial products, and you can see these as examples.  There are features to support subdirectories, wildcards, and also some stock variables.

Exclude all files in C:\temp, but not subfolders:
  C:\temp\*.*

Exclude all WSUS downloaded files with subfolders:
  %windir%\softwaredistribution\*.* /s

Exclude all Firefox browser cached files stored in all user profiles:
  $UserProfiles$\AppData\Local\Mozilla\Firefox\Profiles\tofolsma.default-esr\cache2\*.*

Exclude all enumerated NTLite temp folders and their subfolders
  C:\NTLite.tmp\Temp\NLTmp* /s

Exclude Temp folder from each drive with subfolders
 $AllVolumes$\Temp\*.* /s

Exclude all Windows upgrade files left behind on all volumes:
  $AllVolumes$\$WINDOWS.~BT\*.* /s


Saturday, January 13, 2024

Enable Recycle Bin on all drives (normally not on USB flash)

Source: 
  https://www.elevenforum.com/t/enable-recycle-bin-for-removable-drives-in-windows-11.5106/
  https://winaero.com/how-to-enable-the-recycle-bin-on-removable-drives/

When Windows 10 deletes files on a USB flash drive, you are prompted to "permanently delete" them, meaning no Recycle Bin if it's an accidental deletion. The following registry entries will allow Recycle Bin to activate on flash drives.  This affects in real-time, though you may need to switch explorer pane to a new drive and back, or eject and reinsert the flash drive.

Only the HKLM setting is needed for everyone.
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /t REG_DWORD /d 0xffffffff /f

... or the following for one user.
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /t REG_DWORD /d 0xffffffff /f

Delete these entries from the registry to restore default behavior.
reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /f
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /f

Note: If you are moving the flash drive between machines, you must implement this behavior on each new machine.  If you're not using Group Policies, it may be smart to add a CMD file to affect the HKCU setting on each flash drive you need to maintain a Recycle Bin. 


Tuesday, November 20, 2018

Installing .NET 3.5 on Server 2012 or Server 2016 via cmd

Something on Server 2016 requires .NET 3.5, normally installed in the Server Manager in the Features. However, sometimes the installation media is not configured correctly, and you get an error "source files could not be found" with code 0x800f081f, and a reference to the following to repair DSM sources:
  https://go.microsoft.com/fwlink/?LinkID=243077

If you have the Server 2016 DVD, you can use this command to install off the media.
Command line:
  DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"d:\sources\sxs"


Tuesday, June 30, 2015

Disable RDP Client Printer Mappings on Windows Servers

When you connect RDP to a server, the printer mappings can usually cause Event ID 1111 in the System log due to the printer drivers not being installed on the remote server.  Up until Windows 2008 it was easy to launch TSConfig.MSC and disable printer mappings for good.  Windows Server 2012 no longer has this console, but you can still control this with the same single regval.
Command line:
REG.exe ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /V fDisableCpm   /t REG_DWORD /D 1 /F

Registry file:
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"fDisableCpm"=dword:00000001

With Regedit.exe, you can just search the registry for value "fdisablecpm" and change them all to 1.

You can also try the Group Policy methods, or the GP regvals that affect this location:

Sunday, June 28, 2015

Restore Outlook Favorite Folders


Thanks to some supported users for clicking just the right "I don't know what I did..." and needing their favorites folders back.
  • Close Outlook.
  • Click the Windows Start button in the lower, left corner of the screen.
  • In the field where your cursor is flashing, type "Outlook.exe /resetnavpane".
  • Start Outlook.

Recover SA password in MSSQL

http://v-consult.be/2011/05/26/recover-sa-password-microsoft-sql-server-2008-r2/
http://www.mssqltips.com/sqlservertip/2682/recover-access-to-a-sql-server-instance/

General steps: change to single user, restart SQL server, create a new SysAdmin ID, restart in multiuser, use new SqlAdmin to reset sa password.

Detailed steps:
1) Open SQL Server Configuration Manager
2) Stop all services, including SSIS, SSRS, and SQL agent
3) Right-click properties on the instance, usually 'SQL Server (MSSQLSERVER)'
4) On the Advanced tab, prefix the Startup parameters with '-m;', e.g. '-m;-dC:\Program Files\Microsoft..."
5) Start the SQL instance service.
6) Start the Command Prompt, and execute SQLCMD.
Type the following commands at the 1> and 2> prompts.
   1> CREATE LOGIN sabackup WITH PASSWORD = 'sabackup1'
   2> go
   1> sp_addsrvrolemember 'sabackup','sysadmin'
   2> go
   1> exit
7) Stop the SQL server instance again, revert the Startup parameters, and restart the instance.
8) Use SQL Server Management Studio to change the sa password.

Or, from the 2nd link, a more elegant solution is to login as a local administrator and then use PsExec from PSTools to launch the SSMS as the Local System account:
PsExec -s -i "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe"
... and then edit then edit the SA password.