rsync and the Hard Link Limitation

I’ve been setting up a new backup regime on a hosted server that I’m helping to maintain.

One of the key issues right now is that it is there isn’t a solid provided backup regime, so I’ve spent the day playing around with different Linux backup solutions trying to get to the bottom of a simple, yet robust way of backing up.

I like rsync, but the problem is that you can’t use it’s hard linking feature over secure shell. As such, incremental backups are a pain.

I was about to give up on it, and work out a convoluted tar process when it occurred to me that the hard links might still be possible.

And to that end, I wrote this script: Continue reading rsync and the Hard Link Limitation

Prevent Windows from Reinstalling Group Policy Programs

While Group Policy software distribution is a quick and easy way to get software around a network, it isn’t without its problems. One such problem is when a computer is attached to a new domain. If your software distribution is the same, Windows will still reinstall the MSI packages.

The simplest way is to join export a registry key from a computer that is currently joined to the new domain, and then import it into the new system.

And here it is:

<code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt</code>

Simple Linux DHCP / DNS Server

I’ve just completed the first DNS and DHCP server that I’ve built for a while. This was using Ubuntu Linux 8.04.

The nice thing about the process this time around as opposed to when I set one up a couple of years ago is that I was a little more au fait with the process. The DHCP successfully updated the DNS records, and everything ticked along nicely.

It’s going into production tomorrow, so I’m hopeful that it will fix a number of network problems that a client has been having with the RM DHCP Server service that runs in Windows XP.

If it would be easy to tie the upcoming Samba 4 into the mix, then I think that you have the perfect open source server! I have another server to put together soon, so I plan to write a ‘howto’ and post it here.

Uninstall Ranger from a Computer without the RangerRemove User

Dos Batch FileSometimes it might be necessary to remove Sentinel’s Ranger software from a computer with the minimum of fuss. Even though there is a removal user account. For instance, this may not work.

So here’s a handy script to automitcally disable Ranger on a workstation. This returns some Windows settings back to normal and backs up the Ranger computer info. Just save the code as DeRanger.cmd and run it on any machine that you want to uninstall Ranger.

If you’re having trouble logging into a workstation, either logon as a local administrator or use the Task Manager to stop rgrUIniut.exe in the Processes tab.

DeRanger.cmd

<code>
@echo off

::Stop ranger services
Net Stop ClntCMan
Net Stop SecMon
Net Stop RMNETMON
Net Stop RMNetworkMonitorService

::Remove ranger from winlogon and reset Windows Shell
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v UserInit /t REG_SZ /f /d C:\WINDOWS\system32\userinit.exe
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /f /d Explorer.exe

::Disable ranger services
reg add "HKLM\SYSTEM\CurrentControlSet\Services\ClntCMan" /v Start /t REG_DWORD /f /d 4
reg add "HKLM\SYSTEM\CurrentControlSet\Services\SecMon" /v Start /t REG_DWORD /f /d 4
reg add "HKLM\SYSTEM\CurrentControlSet\Services\RMNETMON" /v Start /t REG_DWORD /f /d 4
reg add "HKLM\SYSTEM\CurrentControlSet\Services\RMNetworkMonitorService" /v Start /t REG_DWORD /f /d 4

::Rename Ranger Registry
reg copy "HKLM\SOFTWARE\Hyperion Security Software" "HKLM\SOFTWARE\Hyperion Security Software_backup" /s /f
reg delete "HKLM\SOFTWARE\Hyperion Security Software" /f

::Rename Rnager Installation Folder
rename "%programfiles%\Ranger" Ranger_

::Now restart
shutdown -f -r -t 0</code>

Adding Printers will Hang a Vista Logon to a Domain

When you’re setting up a Windows Vista system on your network for the first time, you might find that adding printers becomes an issue because the UAC prompt appears.

Unfortunately, if you do this with a logon script – then the logon will hang until the script timeout expires. Worse still, if you’re using Group Policy Preferences to set up the printer it will cause the logon to hang indefinitely.

If you’re experiencing this problem – then you need to make sure that the Trusted Printer settings are either configured correctly, or disabled so that printer installation behaves as it would in previous versions of Windows such as 2000 and XP.

Firstly, you’ll need to open the Group Policy Management console, and navigate to the OU which contains the user accounts that are likely to add printers and edit the policy.

Open User Settings >Administrative Templates > Control Panel > Printers.

To prevent Vista from ever prompting to install the printer drivers, simply disable the Point and Print Restrictions setting. If you need to control where printers can be installed from then you need to edit the Approved Servers setting instead.

If you’ve used group policy preferences, make sure that you’ve set the Run in logged-on user’s security context option.

Once configured, you should be able to log on with a user account that automatically adds the printer without a hitch.

Deleting files older than a specific date or age

I needed to delete a chunk of cookies today – but I didn’t want to delete them all.

Thankfully there is a handy command that is within Windows versions after XP such as Server 2003 and Vista that will enable to clean up without too many problems.

The forfiles command will allow you to set a specific date for a file so that you don’t delete recent cookies:

<code>forfiles /S /p "C:\Users\John\cookies" /D -150 /c "cmd /c del @path"</code>

If you wanted to be super cool and delete multiple user cookie folders you could do something like this:

<code>for /D %D in (C:\Users\*) DO forfiles /S /p "%D\cookies" /D -150 /c "cmd /c del @path"</code>

This will enumerate all of the user folders in the C:\Users folder and then clean up the cookies folders inside.

If you wanted to – you can change the amount of days from 150 days to any other amount you like by changing /D -150 to any other number of days (or even use a specific date).