How To Clean Up C:\Windows\Winsxs

So you’ve been taking a look at what’s eating your hard drive space with WinDirStat or similar and have spotted the C:\Windows\Winsxs folder.

Winsxs stands for Windows Side by Side and is basically where Windows keeps multiple versions of the same .dll’s to allow multiple applications to run without any compatibility problems. If you browse it you’ll see what looks like a lot of duplicate .dll files. I’m not going to go into the in’s and out’s of it here as there are plenty of good run through pages on the web.

What I will do is give you the easy and safe way to clear it down.

From the C:\Windows\System32 folder run:

DISM /online /Cleanup-Image /SpSuperseded

That’s it! Easy!

How To Enable Extra Object Info In Active Directory Using AcctInfo.dll

Quick heads up, it’s an oldie but goodie.

Ever wanted to see all that extra user info in AD such as password last change/next expiry without having to go into ADSIedit or resorting to the command line? Well you can!

Download and install the Windows Server 2003 Resource Kit from here

Next register the AcctInfo.dll found in C:\Program Files\Windows Resource Kits\Tools\ you can do this using the following command:

regsvr32 “C:\Program Files\Windows Resource Kits\Tools\Acctinfo.dll”

Open open the AD Users and Computers MMC and open a user, then check out the new Additional Account Info tab, sweet!

Note: I’m using Windows 7 x64 Professional and only get the extra tab when browsing to the user in it’s OU rather than running a Find, haven’t tested if this is just Win 7 – AD 2003 compatibility issue but it’s worth noting.

How To Bulk Upload DNS Records

The other day I had to add new A records for just over 250 hosts, not something I wanted to do manually! Hunting around I found some good pointers but nothing concrete, so I thought I’d put my process on here.

First, it’s worth making sure you understand and test (if needed) the dnscmd.exe tool. For example, if you want to add a standard A record to you DNS you would use the following:

dnscmd DNSServerName /RecordAdd DNSZoneName HostName RecordType IPAddress

For clarity, this could be:

dnscmd DNSServer1 /RecordAdd domain.com host1 A 192.168.0.10

Once you’ve got that down, we can then manipulate the command to pull in a list of the updates you want to do:

I put the list of IP’s and Hostnames seperated by a space into a .txt file like so:

host1 192.168.0.10
host2 192.168.0.11
host3 192.168.0.12

I then used some basic batch style scripting to pull those into a command:

for /f "tokens=1-2" %i in (C:\dnsimport.txt) do dnscmd DNSServer1 /RecordAdd domain.com %i A %j

Simple!

You can import pretty much most types of record this way.

How To Backup/Restore An Active Directory Integrated DNS Zone

Whenever you make a fundamental change to a DNS zone it’s a good idea to back it up, but how do you do that when your DNS is Active Directory Integrated without taking a system state backup? We’ll take a look at both AD integrated and standalone methods to get a better understanding.

Non-AD integrated (Standalone) DNS:

If you’re running standalone DNS and simply have a Primary/Secondary setup then performing this style of backup is really very simple.  As standard DNS zone file information is stored in the %systemroot%\system32\dns folder (typically C:\Windows\System32\dns). When the DNS service starts it simply loads the dones from these files, likewise when a change is made it creates a backup and places it in the backup folder on the aforementioned path. It’s worth noting that only one backup is maintained so if you make another change the previous backup is overwritten, therefore if you make a sideways copy of these backups you can keep a version as long as you require.

AD Integrated Zones:

As AD integrated zones are stored within the Active Directory they do not have  any files associated with them and therefore are not backed up to the backup directory. So how do we get it out? Using DnsCmd.exe is how!

The Microsoft example of a zone export is as follows:

dnscmd [] /zoneexport

This looks great but here it is in a more useful looking format:

DnsCmd DNSserver1 /ZoneExport example.com example.com.bak

Note that the backup file you have created will land in %systemroot%\System32\dns

How to restore AD Integrated Zones:

Warning: You should only attempt to restore this file as a last resort as it could impact your users especially then allowing for replication to the DNS holding DC’s.

  • Hop onto the DNS Management Console and delete the zone
  • Rename your zone backup to have a .dns extension, in the example above this would go from example.com.bak to example.com.dns
  • Create a new zone with the FQDN of the zone you deleted, if using the New Zone Wizard be sure to uncheck the Store in Active Directory option.
  • When prompted to create a new zone file or use an existing file, choose an existing file, the wizard should automatically fill in the zone FQDN with the .dns extension, this should look the same as your renamed zone file (example.com.dns)
  • Complete the wizard
  • Check the zone information is as per the zone before the changes
  • If all is well, simply change the zone type to Active Directory Integrated.

Job done.

How To Find Your Local NTP Server

So, you get on site and no one knows where their NTP server is, there’s a quick and easy way to find out.

The old schoolers will tell you to use the net time commmand, but this has been deprecated and is no longer recommended for use by Microsoft.

If you still want to use it or you’re on a Windows Server 2000 box

  • Open up a command prompt
  • Type: net time /query \\serveryouwanttoquery

If you’re on anything newer:

  • Open up a command prompt
  • Type: w32tm /query /computer:computeryouwanttoquery /source
  • If you’re having trouble w32tm.exe can be found in “C:\Windows\System32”.

W32tm.exe is a powerful little tool that not only allows you to check the basic status but also completely configure the NTP server/service to whatever your heart desires. For more, check out this technet article over at the Microsoft site.

How To Enable Remote Connections SQL Server 2012 Express

I know I have previously covered this with SQL Server 2008 Express but there’s some subtle differences in SQL Server 2012 Express, so here’s a bullet point guide:

  • Open the SQL Server Configuration Manager
  • Expand SQL Server Network Configuration – Protocols for SQLEXPRESS
  • Enable TCP/IP
  • Right click TCP/IP and open Properties
  • Check the IP2  settings reflect the servers IP address and subnet
  • Check IPAll and ensure that Dynamic Ports is blank and make sure that the TCP port is set to 1433

Try connecting to the server from a remote machine using SQL Management Studio or your favourite tool, you should be good!

If not, expand SQL Server Services from the SQL Server Configuration Manager and change the SQL Browser Service to Automitic and start it, then try again.

Also, it’s worth noting that if you’ve already had a fiddle you may need to double check that you have still got Allow remote connections to this server enabled on the instance options. Here’s how to check:

  • Open Microsoft SQL Server Management Studio and connect to the desired instance.
  • Right click on the instance node and click Properties
  • Click on Connections and check that Allow remote connections to this server is checked and you haven’t limited your maximum number of connections over drastically

Warning: When stopping and starting SQL services it is worth making sure that the databases are not in use so as not to effect any live systems.

How To Clear Down C:\Windows\Installer Safely On XP and Server 2003

Have you ever run something like WinDirStat or TreeSize to figure out where all that precious disk space is going to your C drive and noticed the C:\Windows\Installer directory is chewing up space?

If you have and you’ve thought about deleting files to make space DON’T, you’ll cause yourself some real misery down the line.

Instead use msizap.exe!

On Server 2003 this is usually located on the root of the C drive but if you don’t have it you’ll have to Google for it as it used to be available as part of the Windows Installer Cleanup Utility which Microsoft no longer host due to conflicts with later operating systems.

Either way, open a command prompt and navigate to it’s containing folder. Then simply run:

msizap.exe !G

This will clear all non referenced, damaged, partial and unneeded files in the C:\Windows\Installer directory.

%d bloggers like this: