Empty a log file in Linux

I needed to empty a log file on one of my Linux boxes today as it had grown to 7.5 GB in size. This was achieved by simply running the following command in the directory where the problem file exists, and LOG_FILE was the name of the file to be emptied:

cat /dev/null > LOG_FILE

“Failure configuring Windows updates. Reverting changes” on a Lenovo Laptop

I recently had to apply Windows updates to a new Lenovo laptop running Windows 8. There were about 50 or so updates to apply, but each time I tried to install them I received the following error message on reboot:

“Failure configuring Windows Updates. Reverting Changes”

After the reboot had completed, I examined the update history and found that none of the updates had installed and all were marked as failed. I did a bit of digging, and in the end it turned out that this is a common problem with Lenovo laptops and was caused by a service called the ‘Nalpeiron Licensing Service’. I am not sure why this is pre installed, but it appears that it is not an essential service, so I simply opened the services console (services.msc) and stopped and then disabled this service. After completing this action Windows updates installed without error.

Prepare Active Directory for Exchange 2007

To prepare active directory for Exchange 2007 you need to perform the following actions:

On the Schema master using an account with appropriate privileges navigate to the root of the installation media and run the following from the command prompt:

setup /pl

The command above prepares the legacy permissions. Next run:

setup /ps

This prepares the AD Schema. Next run the following command, where ORGANIZATION_NAME is the name of your Exchange Organization:

setup /PrepareAD /organizationName:ORGANIZATION_NAME

This creates the necessary OUs and security groups for Exchange. Then run:

setup /pd

This prepares the local domain for Exchange.

References:

http://technet.microsoft.com/en-us/library/bb125224(v=exchg.80).aspx

Cisco ASA with Dual ISPs one for Internet and one for VPN example

I had a situation recently where  the 2Mb Internet connection at one of our offices was becoming congested. To try and allieve the congestion I had a new ADSL line installed at the office with the intention on splitting traffic through the ASA. On the ASA 5505 it is not possible to load balance beween the ISPs, so I thought I would leave the exisitng 2Mb connection for VPN traffic only and use the new ADSL connection for Internet traffic. It took me a while to figure out how to do this, and so I thought I would document it here, because actually the solution is pretty simple.

In order to achieve this all you have to do is set up static routes to define the default route through one connection, and the remote VPN peer, and traffic destined for the remote LAN subnet through the other connection. The diagram below explains the set up in a bit more detail:

Cisco ASA with 2 ISPs one for Internet and One for VPN

Cisco ASA with 2 ISPs one for Internet and One for VPN

Firstly set up 3 vlans and their interface associations:

interface Ethernet0/0

switchport access vlan 2

interface Ethernet0/1

interface Ethernet0/2

interface Ethernet0/3

interface Ethernet0/4

interface Ethernet0/5

switchport access vlan 12

interface Ethernet0/6

interface Ethernet0/7

interface Vlan1

nameif inside

security-level 100

ip address 10.0.1.254 255.255.255.0

interface Vlan2

nameif VPN

security-level 0

ip address 172.16.1.1 255.255.255.0

interface Vlan12

no forward interface Vlan1        (If using a security plus or higher license on your ASA 5505 you may not need this command in your set up)

nameif Internet

security-level 50

ip address 192.168.1.1 255.255.255.0

You then need to configure your static routes:

route Internet 0.0.0.0 0.0.0.0 192.168.1.254 1 

(ASA sends all traffic out of this default route via the ISP 1 ADSL connection, unless defined in the other static routes below)

route VPN 10.2.2.0 255.255.255.0 172.16.1.254 1   

 (This static route sends all traffic destined for the remote office subnet i.e. the interesting traffic defined for encryption, over the VPN via the ISP 2 connection)

route VPN 172.16.2.1 255.255.255.255 172.16.1.254 1  

(This static route sends all traffic destined for the remote office VPN Peer via the ISP 2 connection)

The actual setup of the site to site VPN connection is beyond the scope of this article but there is plenty of information elsewhere.

allow PPTP client through Cisco ASA 8.4 to external PPTP server

In order to allow a PPTP VPN client through a Cisco ASA firewall in order to access an external PPTP server you need to add the following to your configuration.

policy-map global_policy

class inspection_default

inspect pptp

NtFrs Event ID 13555 and 13552 The file replication Service is in an error state

I discovered an issue at a client site the other day where event IDs 13555 and 13552 with a source of NtFrs were present in the event log of a Windows Server 2003 Domain Controller. The relevant error messages were as follows:

‘The File Replication Service is in an error state. Files will not replicate to or from one or all of the replica sets on this computer until the following recovery steps are performed’

The File Replication Service is unable to add this computer to the following replica set:

“DOMAIN SYSTEM VOLUME (SYSVOL SHARE)”

In this case the network had a single DC. It appeared from the errors that the SYSVOL share was in an inconsistent state. This error had obviously first occurred some time before and as a result there were no system state backups from when the SYSVOL share was in a consistent state.

To fix the error I had to set the Burflags option to D4 under the following registry key to force the DC into thinking an authoritative restore had been performed:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NtFrs\Parameters\Cumulative Replica Sets\GUID_OF_YOUR_REPLICA_SET\Burflags

After Setting this, and restarting the server the errors disappeared.

In a multi Domain Controller network much more care needs to be taken. On the plus side in this case you will normally have a good copy of SYSVOL on a different DC. Detailed information on how to recover from this error in a multi Domain Controller network can be found in the references below but the basic premise is this:

  • Stop NtFrs on all servers
  • Set Burflags to D4 in the registry of a Domain Controller with a known good copy of SYSVOL and start NtFrs
  • Set Burflags to D2 on the remaining Domain Controllers and start NtFrs

Exercise extreme caution if using the advice above. It is not a substitute for restoring from a good system state backup if you have one, and more of a last resort. In any event refer to the Microsoft documentation for much more detailed instructions.

References:

How to rebuild the SYSVOL tree and its content in a domain

Burflags Query

Create a bootable WinPE boot disk to capture images using imagex

Here is a quick list of commands to create a basic WinPE bootable ISO image to use for capturing images of computers using imagex. First of all make sue that you have downloaded and installed the Windows AIK (Automated Installation Kit) on your computer which can be found here. Once the Windows AIK is installed run the ‘Deployment Tools Command Prompt’ form the Start Menu under ‘Microsoft Windows AIK’. In the ‘Deployment Tools Command Prompt’ run the following command which will create a folder on your C:\ drive called ‘winpe-bootdisk’ with all the necessary files to create the bootdisk:

copype.cmd x86 c:\winpe-bootdisk

The copy the winpe.wim base image to the c:\winpe-bootdisk\ISO\sources folder, renaming it to boot.wim

copy c:\winpe-bootdisk\winpe.wim c:\winpe-bootdisk\ISO\sources\boot.wim

Next you can mount the boot.wim image file to add any other tools that you want to include on the bootdisk. Once mounted the file system for boot.wim file can be found under c:\winpe-bootdisk\mount:

Dism /Mount-Wim /WimFile:C:\winpe-bootdisk\ISO\sources\boot.wim /index:1 /MountDir:C:\winpe-bootdisk\mount

If necessary copy any other tools you want to the boot.wim image e.g. imagex:

copy “C:\program files\Windows AIK\Tools\x86\imagex.exe” C:\winpe-bootdisk\mount\Windows\System32

You may also want to add additional packages or tools e.g. WSH (Windows Scripting Host) support

Dism /image:C:\winpe-bootdisk\mount /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\winpe-scripting.cab”

When you have finished adding stuff to the wim image unmount the boot.wim image and commit ther changes using the following command:

Dism /unmount-Wim /MountDir:C:\winpe-bootdisk\mount /Commit

Finally use oscdimg to create the boot disk ISO image

Oscdimg -n -bC:\winpe-bootdisk\Etfsboot.com C:\winpe-bootdisk\ISO C:\winpe-bootdisk\winpe-bootdisk.iso

After this you can burn the image to CD, and start using it! To capture an image of a computer using your new WinPE boot disk run the following command, where DRIVE_TO_CAPTURE is the name of the drive you want to cature and DESTINATION_FILE is the location and name of the wim file that you want to save the image to:

imagex /capture DRIVE_TO_CAPTURE DESTINTATION_FILE /compress fast verify

e.g.

imagex /capture E: D:\win7-corp.img /compress fast verify

References:

http://technet.microsoft.com/en-us/library/dd744533(WS.10).aspx

http://technet.microsoft.com/en-us/library/dd799303(v=ws.10).aspx