Tuesday, June 30, 2009

How to view mailbox size in Exchange 2007

Use the following script in PowerShell:

Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

This script will list all mailboxes starting with the largest then descending down the page. It will also give you number of items in each mailbox and list size in MB.

You can adjust the Size metric given by changing {$_.TotalItemSize.Value.ToMB()} to either {$_.TotalItemSize.Value.ToKB()} or if you are unlucky {$_.TotalItemSize.Value.ToGB()}. Also if you would like to change the listing at the top of the report make a similar change to the "TotalItemSize(MB)" expression.

Also take a look at this posts:
http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/1d95e6b4-e3cf-4bce-85af-8ce0d94d9cef
http://exchangeshare.wordpress.com/2008/04/23/emc-where-are-mailbox-total-items-size-kb-columns/
http://www.exchangeninjas.com/MailboxSizeReport

Friday, June 26, 2009

Exchange Server 2007 Installation

Some useful links about Exchange Server 2007 installation:

Installing Cluster Continuous Replication on Windows Server 2008
http://www.msexchange.org/articles_tutorials/exchange-server-2007/high-availability-recovery/deploying-exchange-2007-sp1-ccr-cluster-windows-server-2008-failover-cluster-part1.html
http://technet.microsoft.com/en-us/library/bb629714.aspx
http://technet.microsoft.com/en-us/library/bb676403.aspx
http://unifiedcommunications.mindsharpblogs.com/RussK/archive/2009/04/03/Exchange-Server-2007-CCR-on-Windows-Server-2008-Failover-Cluster.aspx

Exchange 2007 SP1 SCC using Server 2008 StarWind iSCSI
http://www.shudnow.net/2008/03/13/exchange-2007-sp1-scc-using-server-2008-starwind-iscsi-part-1/

Installing Exchange 2007 SP1 on Windows Server 2008
http://aspoc.net/archives/2008/09/02/installing-exchange-2007-sp1-on-windows-server-2008/
How to Install Exchange 2007 SP1 and SP2 Prerequisites on Windows Server 2008 or Windows Vista
http://www.exchange-genie.com/2008/02/installing-exchange-2007-on-windows-2008/
http://www.commodore.ca/windows/exchange/how_to_setup_exchange_2007_in_2hours.htm
http://www.commodore.ca/windows/exchange/exchange_2007_advanced_topics.htm
http://www.msexchange.org/articles-tutorials/exchange-server-2007/migration-deployment/exchange-2007-install-configuration-command-line-part1.html
http://www.msexchange.org/tutorials/Installing-Exchange-2007-Part2.html

Configuring a Two-Node File Server Failover Cluster
http://technet.microsoft.com/en-us/library/cc731844(WS.10).aspx

How to configure winRM in Windows

Enable winrm
for Windows XP or Windows Server 2003 install this update
http://support.microsoft.com/default.aspx?scid=kb;EN-US;936059
then enter this command for a quick configuration
winrm quickconfig

or manualy

winrm create winrm/config/listener?Address=*+Transport=HTTP
netsh firewall add portopening TCP 80 "Windows Remote Management"

Change default port from 80 to 8181
Winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="8181"}

Create an https listener
winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="";CertificateThumbprint=""}

Create an https listener and bind it to a specific ip address
winrm create winrm/config/Listener?Address=a.b.c.d+Transport=HTTPS @{Hostname="servername";CertificateThumbprint=""}

Enumerate configuration
winrm enumerate winrm/config/listener

Disable winrm
winrm delete winrm/config/listener?Address=*+Transport=HTTP

Change command prompt
if you want to identify the hostname of the remote server you are working with you can add an Extended String value in this registry key

HKLM\System\CurrentControlSet\Control\Session Manager\Environment

The value I use is [%Computername%]$s$p$g

See also these links for more tips
http://blogs.technet.com/jonjor/archive/2009/01/09/winrm-windows-remote-management-troubleshooting.aspx

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-and-winrs.aspx

Monday, June 22, 2009

Windows 7 and Windows Server 2008 R2 KMS Client Setup Keys

Windows 7 Professional - FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional N - MRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Enterprise - 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise N - YDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise E - C29WB-22CC8-VJ326-GHFJW-H9DH4

Windows Server 2008 R2 HPC Edition - FKJQ8-TMCVP-FRMR7-4WR42-3JCD7
Windows Server 2008 R2 Datacenter - 74YFP-3QFB3-KQT8W-PMXWJ-7M648
Windows Server 2008 R2 Enterprise - 489J6-VHDMP-X63PK-3K798-CPX3Y
Windows Server 2008 R2 for Itanium-Based Systems - GT63C-RJFQ3-4GMB6-BRFB9-CB83V
Windows Server 2008 R2 Standard - YC6KT-GKW9T-YTKYR-T4X34-R7VHC
Windows Web Server 2008 R2 - 6TPJF-RBVHG-WBW2R-86QPH-6RTM4

Configuring the Firewall for Remote Management of a Workgroup Server Core installation

from http://blogs.technet.com/server_core/archive/2008/01/14/configuring-the-firewall-for-remote-management-of-a-workgroup-server-core-installation.aspx and http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/04/03/remotely-managing-your-server-core-using-compmgmt-msc.aspx we read:

Just like on a full server installation, the firewall is on by default in a Server Core installation and most inbound traffic is blocked at the end of setup. There are then three scenarios for remote management via MMC:
Server Roles – when a server role is installed, the appropriate ports are opened to allow the role to function as well as to allow remote management, so no additional configuration is required. Using the Remote Server Administration Tools (RSAT) feature on a full server installation, you can install just the MMC snap-ins for a role and use them to remotely manage the role on Server Core.
Domain joined – Once domain joined, the firewall profile is changed to the domain profile which allows remote management. Again, no additional configuration is required.
Workgroup server – This is the scenario in which you may need to make firewall configuration changes to allow remote management. If you just want all remote management to work you can use:

Netsh advfirewall firewall set rule group="remote administration" new enable=yes

However, it is possible to be more granular and only allow certain MMC snap-ins to remotely manage the box.
Note that the other methods of remote management are either enabled out of the box, such as WMI, or when enabled the firewall is configured to allow them, such as Terminal Server remote administration mode.

As mentioned you can simply enable the Remote Administration firewall rules to allow pretty much any MMC to connect (a few require additional configuration as discussed below). However, there may be situations where you only want to allow certain MMCs to connect for remote administration. Not every MMC snap-in has a firewall group, here are those that do:

MMC Snap-in --> Rule Group
------------------------------------------------------------------------
Event Viewer --> Remote Event Log Management
Services Remote --> Service Management
Shared Folders --> File and Printer Sharing
Task Scheduler --> Remote Scheduled Tasks Management
Reliability and Performance --> "Performance Logs and Alerts" and "File and Printer Sharing"
Disk Management --> Remote Volume Management
Windows Firewall with Advanced Security --> Windows Firewall Remote Management

On the Server Core box you can enable these by running:

Netsh advfirewall firewall set rule group="" new enable=yes

Where is the name in the above table.

You can remotely enable these using the Windows Firewall with Advanced Security MMC snap-in, after you have locally on the Server Core box enabled the rule group to allow it to connect.

MMC Snap-ins without a Rule Group

Not every MMC snap-in has a rule group to allow it access through the firewall, however many of them use the same ports for management as those that do. Therefore, you will find that enabling the rules for Event Viewer, Services, or Shared Folders will allow most other MMC snap-ins to connect. Of course, you can also simply enable the remote administration rule group (see my last post).

MMC Snap-ins that Require Addition Configuration

In addition to allowing the MMC snap-ins through the firewall, the following MMC snap-ins require additional configuration:

* Device Manager
To allow Device Manager to connect, you must first enable the “Allow remote access to the PnP interface” policy:
1. On a Windows Vista or full Server installation, start the Group Policy Object MMC snap-in
2. Connect to the Server Core installation
3. Navigate to Computer Configuration\Administrative Templates\Device Installation
4. Enable “Allow remote access to the PnP interface”
5. Restart the Server Core installation

* Disk Management
1.You must first start the Virtual Disk Service (VDS) on the Server Core installation
2.You must enable the "Remote Volume Management" firewall group in both Server and Client

* IPSec Mgmt
On the Server Core installation you must first enable remote management of IPSec. This can be done using the scregedit.wsf script:
Cscript \windows\system32\scregedit.wsf /im 1

Examples

netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes
netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes
netsh advfirewall firewall set rule group="Performance Logs and Alerts" new enable=yes
Netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes
Netsh advfirewall firewall set rule group="Remote Scheduled Tasks Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
netsh advfirewall firewall set rule group="Windows Firewall Remote Management" new enable =yes
netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable =yes
sc config vds start= auto
net start vds

How to disable the firewall
netsh advfirewall set allprofiles state off

How to enable the firewall
netsh advfirewall set allprofiles state on

Thursday, June 18, 2009

Installing WSUS 3.0 SP1 through Windows Server 2008 SP2 Server Manager

from http://blogs.technet.com/wsus/archive/2009/05/12/installing-wsus-3-0-sp1-through-windows-server-2008-sp2-server-manager.aspx we read:

By default, Windows Server 2008 SP2 includes the ability to install the Windows Server Update Services Role Service by using Server Manager. This role lets you use the MMC Server Manager snap-in and wizards to install, configure, and manage WSUS 3.0 SP1. This behavior is different from Windows Server 2008 SP1 where the administrator needed to install an update to Server Manager to be able to install WSUS as a Role.

Important:
There is no need to install "Update for Windows Server 2008 Server Manager" (KB940518). This update is only applicable to Windows Server 2008 SP1 computers.

Deployment Instructions
To install WSUS 3.0 SP1 on a Windows 2008 Server SP2 server that is pointed to Windows Update or Microsoft Update, go directly to Server Manager and install the WSUS Role.
To install WSUS 3.0 SP1 on a server running Windows Server 2008 SP2 which is being updated by a WSUS server, do the following procedure.
* Enable the following Product Classifications:
- Updates
* Enable the following Category:
- Windows Server 2008 Server Manager – Windows Server Update Services (WSUS) Dynamic Installer category is a container for WSUS updates. These updates are “hidden” such that user will never see a notification or be downloaded by WUA. These updates can only be downloaded via the WUA APIs. Server Manager is using this method to download and start the install of WSUS.
* Approve the Windows Server Update Services 3.0 SP1 Dynamic Install for Windows Server 2008 (KB948014) (there’s one for x86 and one for x64). This specific WSUS package is targeted at Windows Server 2008 computers that do not have WSUS installed. This package will only install via Server Manager.
Note: Since the update is targeted at any Windows Server 2008 computers that don’t have the WSUS role installed, these machines will report that the update “is needed”. You do not have to install this update on these computers if you do not want it.
After WSUS is detected as installed by Server Manager it can be configured and managed within the Server
Manager UI/WSUS Snap-in.

Wednesday, June 17, 2009

Install Linux IC in a Hyper-V VM

from http://itproctology.blogspot.com/2009/05/layers-to-linux-on-hyper-v.html we read

a) Obtain the LinuxIC.iso
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ab7f4983-93c5-4a70-8c79-0642f0d59ec2#tm

b) obtain the inputvsc.iso for the mouse driver
http://www.xen.org/download/satori.html

c) add the kernel-source and gcc-c++ packages
YaST can be used for this, either GUI or command line
Note: if an ISO was previously attached, you may need to detach, pause, then attach the desired ISO for SuSE auto-mount to pick up the change.
If that does not work, make a mount point ( mkdir /media/CDROM ) and mount /dev/hdc /media/CDROM

d) Install the linuxic drivers
a. Open a Terminal
b. attach the downloaded LinuxIC.iso through the Hyper-V manager
c. Create a folder and copy the contents to the folder
d. mkdir /tmp/linuxic
e. cp –rp /media/CDROM/* /tmp/linuxic
f. cd /tmp/linuxic
g. ./setup.pl drivers

e) Install the mouse driver
a. Attach the inputvsc.iso through the Hyper-V manager
b. Create a folder and copy the contents.
c. mkdir /tmp/inputvsc
d. cp –rp /media/CDROM/* /tmp/inputvsc
Note: you may need to mount again: mount /dev/hdc /media/CDROM
e. cd /tmp/inputvsc
f. ./setup.pl

f) Power down the VM, remove the Legacy Network Adapter, add a Synthetic Network adapter, power on the VM (you could also do a shutdown now –hP)

g) Using YaST (or YaST2), configure the newly installed synthetic network adapter.

Tuesday, June 16, 2009

How do I view other users' mailbox in Outlook

from http://kb.iu.edu/data/agny.html we read:

If you have permission to access any folders in another user's Exchange mailbox in Outlook, you may open the folders on demand. If you need more frequent access to them, or access to a subfolder, you may add another user's mailbox to your Outlook Folder List.

Opening another user's folder on demand in Outlook 2000, 2002, 2003, or 2007

This method will allow you to open one of the primary mailbox folders (Calendar, Contacts, Inbox, Journal, Notes, or Tasks) in a separate window that will not reappear the next time you start Outlook:
1. From the File menu, select Open, and then Other User's Folder... .
2. In the Open Other User's Folder window, type the other person's username, or use the Name... button to select the person's name from the Address Book.
Note: You can only open the mailbox of another Exchange user.
3. From the drop-down list, select the folder you wish to open. If that folder is not listed, the only way you can access it is to add the other user's mailbox to your Outlook Folder List.
4. Click OK or Open. The folder should open in a new window. If you receive an error message about permissions, check with the mailbox's owner to ensure that you have permission to access the folder you're trying to open.

Adding another user's mailbox to your Outlook Folder List in Outlook 2000, 2002, 2003, or 2007

Note: Although you can add other users' mailboxes to your Outlook Folder List without having any permissions for their mailboxes, you will not be able to view them unless you have at least Reviewer permission.
1. In Outlook 2007, from the Tools menu, select Account Settings... . Highlight Microsoft Exchange, and click Change. Then click the More Settings... button.
In Outlook 2002 and 2003, from the Tools menu, select E-mail Accounts... and then select the radio button next to View or change existing email accounts. Click Next. At the next screen, highlight Microsoft Exchange Server, and click Change. Then click More Settings.
In Outlook 2000, from the Tools menu, select Services... . Highlight Microsoft Exchange Server and click Properties.
2. Click the Advanced tab, and then click the Add... button. This allows you to add mailboxes to your Outlook Folder List.
3. In the "Add Mailbox" field, enter the username or name (in lastname, firstname format) of the person to whose mailbox you have shared access.
4. You should now see the additional mailbox on the Folder List. (If you can't see the Folder List, select View, and then Folder List.) Any folders that a user gives you permission to access should be listed under the other person's mailbox. If you cannot expand the Folder List, the other person has not given you permission to access the mailbox.
5. If you like, you can create a shortcut to a folder by dragging it to the Outlook Bar (the leftmost column visible)

How do I allow other users to view my folders in my Exchange mailbox?

From http://kb.iu.edu/data/aisw.html we read:
In Outlook for Windows, if you have an Exchange mailbox, you can allow others within your Exchange organization to access folders in your Exchange mailbox, including your calendar. You can use Microsoft Outlook to share your mailbox folders and to access others' mailbox folders that have been shared with you.

Outlook allows two types of sharing:

* Folder permissions: This type of sharing allows selected others to view the contents of a specified folder, but does not allow others to send email on your behalf. When setting up folder permissions, you can determine exactly how much access a given person has to your folder, choosing from nine roles with different permissions:

o Owner: Allows full rights to the mailbox, including assigning permissions; you should not assign this role to anyone
o Publishing Editor: Can create, read, edit, and delete all items, and create subfolders
o Editor: Can create, read, edit, and delete all items
o Publishing Author: Can create and read items, create subfolders, and edit and delete items they've created
o Author: Can create and read items, and edit and delete items they've created
o Nonediting Author: Can create and read items, and delete items they've created
o Reviewer: Can read items
o Contributor: Can create items
o None: Gives no permissions for the selected accounts on the specified folder

* Delegates: You can also designate delegates, who can have different permissions but also the additional ability to send email on your behalf. By default, a delegate has Editor permissions on the Calendar and Tasks folders.

Setting folder permissions in Outlook

First, you need to give the other person access permission to both the mailbox and the specific folder in the mailbox. Assign permissions along the entire path down to the folder you want to share; for example, if you want others to have access to a subfolder in your Inbox, you need to assign permissions to the mailbox folder, the Inbox folder, and the subfolder. To set permissions on folders:
1. Open Outlook, and find the Folder List. If you don't see the Folder List, from the Go (Outlook 2007 and Outlook 2003) or View (Outlook 2002 and earlier) menu, click Folder List. Then, from the Folder List, right-click the folder you wish to share (this could be your mailbox, Inbox, or calendar, or a subfolder).
2. From the menu that appears, select Properties, and then click the Permissions tab.
Note: If you do not see the Permissions tab, you probably have Personal Folders set as your default delivery location. In order to grant permissions, set the default delivery location to your Microsoft Exchange mailbox. See In Microsoft Outlook, why is my Exchange email disappearing from my Inbox at work after I read it at home?
3. Click Add... , and select the people to whom you wish to grant permissions. After each selection, click Add-> . When you are done, click OK.
4. You can now select which permissions to grant. If you wish to grant only the ability to view items in this folder, assign the role of Reviewer. For more on permissions, see the list above.
To grant permissions, select a name from the box beneath "Name:" and "Permissions:", and then from the drop-down menu beside "Permission Level:" or "Role:", make your selection. You can also create custom permissions by making selections from the checkboxes and radio buttons within the "Permissions" area. Once you've finished making your selections, click Apply, and then OK.
Important: In the list under "Name:", the group called "Default" includes everyone at Indiana University who has an Exchange account. Under normal circumstances, you should not assign permissions to it; leave it set to None. If you grant any permissions or assign a role to it, you are granting those permissions to everyone with an IU Exchange account.
5. Those to whom you have granted permissions now need to set up Outlook to view your folders.

Monday, June 15, 2009

Loading/Installing Grub4dos From Windows

Check http://diddy.boot-land.net/grub4dos/files/install_windows.htm#windows3

How to configure time service in Windows Servers

Change the Windows Time service configuration on the previous PDC emulator

Open a command prompt and type the following commands:
w32tm /config /syncfromflags:domhier /reliable:no /update
W32tm /config /update
W32tm /resync

On a Windows Server 2008 R2 enter these commands:
net stop w32time
w32tm /register
net start w32time

------------------------------------------------------------------------------

Configure the PDC emulator to synchronize from its internal hardware clock

Open a command prompt and type the following commands:
w32tm /config /syncfromflags:domhier /reliable:yes /update
W32tm /config /update
W32tm /resync

------------------------------------------------------------------------------

Configuring the forest root domain PDC FSMO to use an another time source

Open a command prompt and type the following commands:
W32tm /config /manualpeerlist:"212.251.14.84 192.108.114.23 193.93.167.241" /syncfromflags:manual
W32tm /config /update
W32tm /resync

------------------------------------------------------------------------------

Query sntp servers

Open a command prompt and type the following command:
net time /querysntp

Also take a look at these articles:
http://theessentialexchange.com/blogs/michael/archive/2010/01/29/a-brief-history-of-time-ok-ok-let-s-go-with-quot-an-introduction-to-the-windows-time-service-quot.aspx
http://technet.microsoft.com/en-us/library/cc773061%28WS.10%29.aspx

Sunday, June 14, 2009

How to create a bootable USB flash drive using grub

from http://www.themudcrab.com/acronis_grub4dos.php we read:

Introduction

Grub4DOS is a boot manager that can be easily installed to a flashdrive or hard drive. It allows booting multiple operating systems directly as well as booting into bootable partitions.

For the purpose of this guide, Grub4DOS will be used to setup a flashdrive to boot the Acronis Resuce Media. This can be done by booting to the partition on the flashdrive (as setup by the Acronis Media Builder program) or by directly booting the Acronis ISO file. When you use the ISO method, you can put as many Acronis ISO images as required on the same flashdrive. This allows you to easily be able to boot into True Image Home 9, 10, 11, 2009, Echo Workstation, etc. by just selecting the desired menu entry.


It is highly recommended that you read through the entire instructions before you begin this procedure.

Either of these methods work equally well on USB hard drives or internal drives too as long as another boot manager (such as BootIt NG) is not installed on the drive.

While it is always recommended to have backups of any important data before making any changes to your drives, installing Grub4DOS is not a destructive procedure. Existing partitions and data on the flashdrive should not be erased or corrupted in any way.

Section 1 - Installing Grub4DOS

Before Grub4DOS can be installed, several files need to be downloaded and unzipped. One is the Grub4DOS program and the other is the Installer. Click on the links below to download the files. Save them to a known location (My Downloads, for example) so they're easy to find.



For those interested, more information on Grub4Dos can be found at the following locations:

Grub4Dos Main Page
Grub4Dos Tutorial
Grub4Dos Guide (hosted by boot-land.net)
Grub4Dos GUI Installer Downloads

Extract the downloaded zip files into separate folders. For example, you may unzip Grub4DOS to C:\Grub4DOS and the Installer to C:\Grub4DOS-Installer. You may also choose to unzip them into a folder named after the zip file's name.

Click here if you need help using Windows to extract the contents of a zip file.

If your flashdrive is not already plugged into the computer, plug it in now.

The next step is to run the Grub4DOS Installer on the flashdrive. Browse to the Installer's unzipped folder using Windows Explorer.

1.1

In Windows XP, just run the grubinst_gui.exe program.

In Vista, you'll need to run grubinst_gui.exe in Administrator mode. Right-click on the program file and select Run as administrator from the pop-up menu.

1.2

You may get a security pop-up window asking if you want to run the program. Select Run to start the program.

1.3

In Vista, if you have UAC turned on (the default setting), you'll get another warning. Select Allow to let the program start.

1.4

Once the program is started, select the Disk option, then click the Disk Refresh button and then select your flashdrive from the dropdown box.

1.5

You should be able to tell which disk is your flashdrive by the size shown for each drive. In this example, my 8GB flashdrive is easy to pick out.

1.6

IMPORTANT: Make sure you select your flashdrive from the dropdown list and not a different drive (if installing to a USB hard drive or an internal drive, make sure it's the correct one). If you accidentally select the wrong drive, you may not be able to boot your system without doing a boot repair.

Now click the Part List Refresh button, then the dropdown box and finally select the Whole disk (MBR) option.

1.7

Check the Don't search floppy option, leave all the other options unchecked and cleared and then click the Install button to install Grub4DOS to the MBR of the flashdrive.

1.8

Hopefully, you'll get the message that the installation was successful.

1.9

Press Enter to close the Command Prompt window. The Grub4DOS MBR and booting code is now installed on the flashdrive.

The next step is to copy the grldr file to the flashdrive's root folder. Using Windows Explorer, browse to the folder where you unzipped the Grub4DOS program and copy the file to the flashdrive.

1.10

Grub4DOS is now installed on the flashdrive. Depending on how you want to boot your flashdrive to the Acronis Media, select one of the Sections below to continue.

Section 2 - Setup Booting of an Acronis Partition

Using this method, Grub4DOS just boots to the boot sector of the partition on the flashdrive to start the Acronis Media. This is very similar to using a standard bootable flashdrive. You can only have one version/build of your Acronis Media on the flashdrive.

Please note that if the flashdrive's partition table or structure is non-standard, the Acronis Media may have a problem booting using this method just as it would using a non-Grub4DOS MBR.

There are only two steps needed to use your Grub4DOS flashdrive in this fashion.

First, run the Acronis Media Builder on the flashdrive as you normally would. This will install the proper boot sector code to the partition and copy all necessary files to the flashdrive.

Second, create the Grub4DOS menu.lst file with the entry to start the Acronis Media. The menu.lst file is a plain text file created using the Windows Notepad program. This file must be located in the root folder of the flashdrive. Start the Notepad program and type (or copy and paste) in the following text:

timeout 10
default 0

title Acronis True Image Home 2009 (9,615)
chainloader (hd0,0)+1

title CommandLine
commandline

title Reboot
reboot

title Halt
halt

2.1

In this example, I've used Acronis True Image Home 2009 (9,615) as the menu entry's title for the Acronis Media. Feel free to use whatever name you want.

Save the file to the root folder of the flashdrive with the name: menu.lst

If Notepad appends a ".txt" to the filename, just rename the file to menu.lst using Windows Explorer.

If you have the Windows Explorer option set to hide filename extensions for known file types, you may need to disable it. Otherwise, explorer may display menu.lst when the actual filename is menu.lst.txt. Click here for instructions.

2.2

A sample menu.lst file can be downloaded below. If you use it, make sure to rename it to menu.lst once it's on the flashdrive.

To update this flashdrive to a different version or build of the Acronis Media, just rerun the Media Builder program on the flashdrive. No other changes are needed unless you want to edit the title in the menu.lst file to reflect the change.

Section 3 - Setup Booting of an Acronis ISO File

The ability to boot ISO files directly is one of the newer features of Grub4DOS. It is still a work in progress and has problems with some types of ISO files. However, in my use and testing, it hasn't had any problems with the Acronis ISO files.

The flexibility allowed by being able to boot the ISO file directly makes keeping multiple versions and/or different builds on the same flashdrive an easy task. Adding them is as simple as putting the ISO file on the flashdrive and adding the menu entry to boot it.

As with the partition method, there are only two steps needed to use your Grub4DOS flashdrive in this fashion.

First, run the Acronis Media Builder. However, instead of specifying the flashdrive as the destination device, select to create an ISO file. You can save the ISO file directly to the flashdrive if you wish.

Second, create the Grub4DOS menu.lst file with the entry to start the Acronis Media. The menu.lst file is a plain text file created using the Windows Notepad program. This file must be located in the root folder of the flashdrive. Start the Notepad program and type (or copy and paste) in the following text:

timeout 10
default 0

title Acronis True Image Home 2009 (9,615)
map (hd0,0)/ti-12-9615.iso (hd32)
map --hook
chainloader (hd32)
boot

title CommandLine
commandline

title Reboot
reboot

title Halt
halt

3.1

In this example, I've used Acronis True Image Home 2009 (9,615) as the menu entry's title for the Acronis Media. Feel free to use whatever name you want. Also note that I used ti-12-9615.iso for the ISO filename. You can use whatever name is appropriate, however I would recommend you don't put spaces into the ISO's filename.

Save the file to the root folder of the flashdrive with the name: menu.lst

If Notepad appends a ".txt" to the filename, just rename the file to menu.lst using Windows Explorer.

If you have the Windows Explorer option set to hide filename extensions for known file types, you may need to disable it. Otherwise, explorer may display menu.lst when the actual filename is menu.lst.txt. Click here for instructions.

3.2

A sample menu.lst file can be downloaded below. If you use it, make sure to rename it to menu.lst once it's on the flashdrive. You will also need to edit it as necessary for your ISO's filename.

To update this flashdrive to a different version or build of the Acronis Media, just rerun the Media Builder program and save the new ISO file to the flashdrive. If you are replacing an existing ISO file, no other changes are needed. If you are adding an ISO file, edit the menu.lst file and add the new menu entry. For example: If you want to add your True Image Home 10 build 4,942 ISO (ti-10-4942.iso) to the flashdrive, you would put the ISO file on the flashdrive and add the following menu entry:

title Acronis True Image Home 10 (4,942)
map (hd0,0)/ti-10-4942.iso (hd32)
map --hook
chainloader (hd32)
boot

Additional Notes
  • In these instructions, the timout value for booting the default Grub4DOS menu entry is 10 seconds. If you want a shorter or longer time, change the value.
  • If you setup to boot the ISO files, you can place the ISO files into folders instead of having them in the root folder. For example: If you want all of your Acronis ISO files to be in the \acronis folder, just modify the entry in the menu.lst file to include the folder in the path to the ISO file: map (hd0,0)/acronis/ti-12-9615.iso (hd32)

Saturday, June 13, 2009

Installing VMware Tools on Linux

from http://searchvmware.techtarget.com/tip/0,289483,sid179_gci1358739_mem1,00.html?track=NL-917&ad=707221&asrc=EM_NLN_7587295

The Linux command-line interface can be unfamiliar territory for Windows administrators who now have a Linux machine in their virtual environment, making it difficult to install VMware Tools. VMware Communities always features a couple of posts on how to install VMware Tools in a Linux system. While there are several ways to do this, this how-to article explains how to install VMware Tools for CentOS and Red Hat Enterprise Linux (RHEL) version 5. The steps outlined below can also be used as a script to automatically update or install VMware Tools on Red Hat or CentOS Linux 5. (For those using version 3 or 4 of CentOS or Red Hat Linux, there are other methods available, which I will discuss in another tip.) The definitive VMware Tools installation guide covers VMware OS-specific tools, which is the method we use here.

1. Install your Red Hat or CentOS virtual machine (VM) using whichever mechanism works best for your environment. I use a Preboot eXecution Environment, or PXE, bootserver for such things.

2. Configure the Red Hat or CentOS VM using your standard procedures.

Then, perform the following additional configuration steps:

1. rpm --import http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub

2. Use the following script to create a repository file useable by the yum command.

Note that you need to substitute with 3.5u2, 3.5u3, or 3.5u4. You also need to substitute with either i686 or x86_64 depending on whether your VM is a 32-or 64-bit VM, respectively.

cat > > /etc/yum.repos.d/vmware-tools.repo < < EOF [vmware-tools]
name=VMware Tools for Red Hat Enterprise Linux $releasever - $basearch
baseurl=http://packages.vmware.com/tools/esx//rhel5/

enabled=1
gpgcheck=1
gpgkey= http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
EOF

For example, within a 32-bit VM where the ESX version is v3.5 U3 I used the following:

cat > > /etc/yum.repos.d/vmware-tools.repo < < EOF
[vmware-tools]
name=VMware Tools for Red Hat Enterprise Linux $releasever - $basearch
baseurl=http://packages.vmware.com/tools/esx/3.5u3/rhel5/i686
enabled=1
gpgcheck=1
gpgkey= http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
EOF

To remove the tools, make the following commands:

1. yum remove vmware-tools-* open-vm-tools-*
2. yum -y install xorg-x11-drv-vmware xorg-x11-drv-vmmouse
3. yum -y install vmware-tools open-vm-tools-xorg-drv-display open-vm-tools-xorg-drv-mouse

Attempting this method with RHEL 5 Update 3 versions of VMware Tools, however, will result in failure to install VMware Tools as the GPG key is handled incorrectly. The only solution is to disable GPG checking. To do so, change the line within /etc/yum.repos.d/vmware-tools.repo from

gpgkey=1

to

gpgkey=0

Once completed, you can safely update and install VMware Tools without GPG errors.

Upgrading VMware Tools
It's easy to upgrade VMware Tools when you update your Red Hat distribution by using the following command:

yum -y update

If, however, your kernel is too new, you can't update from the VMware Tools OS-specific package repository and will have to build drivers locally. To do so, execute the following commands. Of importance: will be 3.5u2, 3.5u3 or 3.5u4. Also, you'll most likely want to run these commands on a development machine, as you need to install compilers and other build tools. The result will be a redistributable VMware Tools kernel module image that you can install in other VMs.

1. yum list < /tmp/t

2. vname=`grep vmware-tools /tmp/t|awk '{print $2}'`

3. version=`basename $vname .el`

4. wget http://packages.vmware.com/tools/esx//rhel5/SRPMS/open-vm-tools-kmod-$version.src.rpm

5. wget http://packages.vmware.com/tools/esx//rhel5/SRPMS/vmware-tools-kmod-$version.src.rpm

6. yum -y install yum-utils rpm-build

You may need to double-check the version of kernel-devel that is installed by the next command so that it matches your running kernel. In some cases, it will not be the latest version of the kernel.

7. yum-builddep -y open-vm-tools-kmod-$version.src.rpm vmware-tools-kmod-$version.src.rpm

8. rpmbuild --rebuild open-vm-tools-kmod-$version.src.rpm

9. rpmbuild --rebuild vmware-tools-kmod-$version.src.rpm

10. rpm -ivh /usr/src/redhat/RPMS/i386/open-vm-tools-kmod -`uname -r`-$version.i386.rpm /usr/src/redhat/RPMS/i386/vmware-tools-kmod-`uname -r`-$version.i386.rpm

How do I wipe data from Cisco routers and switches

from http://blogs.techrepublic.com.com/networking/?p=1570&tag=nl.e115

Clear the configuration of your router

When it comes to clearing your Cisco router, you have two acceptable options. While most network administrators are familiar with both methods, they typically use them for different tasks.

The first method involves setting the configuration register to 0×2142. Most admins use this method to recover a password, but you can recover a password and wipe the configuration at the same time.

Follow these steps:

1. Log on to the router, and enter the privileged EXEC mode by entering enable and then entering the enable password command.
2. Enter configure terminal to go to Global Configuration Mode.
3. Enter config-register 0×2142. (This causes the router to ignore the startup configuration on the next reload.)
4. Enter end, and reload the router by entering reload at the Router# prompt.
5. The system will ask whether you want to save the configuration. Enter no, and confirm the reload at the next prompt.
6. After the router has reloaded, the system will ask whether you want to enter the initial configuration dialog. Enter no.
7. Change the configuration register setting to 0×2102 by entering enable and configure terminal to go back to Global Configuration Mode and then entering config-register 0×2102.
8. Enter end, and then enter write memory to overwrite the existing startup configuration with the current blank running configuration.
9. Enter reload to reload the router and complete the wiping operation.

However, if you already know the password to the router, you can use the second method. Follow these steps:

1. Log on to your router, and enter the privileged EXEC mode by entering enable and then entering the enable password command.
2. Enter configure terminal to go to Global Configuration Mode.
3. Enter config-register 0×2102.
4. Enter end, and then enter the write erase command to delete the current startup configuration on the router.
5. Enter reload to reload the router. When the system asks whether you want to save the configuration, enter no.

When the router reloads, it will reset back to the original factory defaults.
Clear the configuration of your switch

If your Cisco switch runs the CatOS, the procedure to wipe the configuration is relatively quick. Follow these steps:

1. Log on to your switch, and enter the privileged EXEC mode by entering enable and then entering the enable password command.
2. Enter clear config all to reset the entire system. You don’t need to reload the switch because processing the command wipes the switch. If you’ve set a boot option, you need to change that option using the set boot command.

If your switch runs Cisco IOS, it maintains a running configuration file and a startup configuration file, both of which you need to clear. Follow these steps:

1. Log on to your switch, and enter the privileged EXEC mode by entering enable and then entering the enable password command.
2. Enter write erase, which erases the NVRAM file system and removes all files.
3. At the prompt, confirm that you want to erase all files.
4. Enter reload, and enter no when prompted whether to save the configuration. (Otherwise, the switch will reload the current running configuration.)
5. Confirm that you want to reload the switch, and your switch configuration is almost clean.

It’s almost clean, but not quite. Most people forget to clear any VLAN information they’ve created for their switches. Depending on the hardware version of your switch and the software version of your OS, the command for this varies. For more information, check out Cisco’s “Resetting Catalyst Switches to Factory Defaults” documentation, which walks you through the commands for clearing VLAN information from your switch.

Friday, June 12, 2009

How to disable ipv6 in Vista and Windows Server 2008 using a batch file or group policy

from
http://thesystemadministrator.com/the_system_administrator/tips_%26_tricks/disable_ipv6_over_all_interfaces_and_prefer_ipv4_to_ipv6/
we can use the following batch file:

@Echo off
@ECHO Windows Registry Editor Version 5.00 > %TEMP%\DisableIPv6.reg
@ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters] >> %TEMP%\DisableIPv6.reg
@ECHO "DisabledComponents"=dword:000000ff >> %TEMP%\DisableIPv6.reg
REGEDIT /S %TEMP%\DisableIPv6.reg

if you want to use group policy check this site:
http://www.expta.com/2009/02/how-to-configure-ipv6-using-group.html

Thursday, June 11, 2009

How to create a bootable USB flash drive using grub

from http://www.marwanshaher.com/USB/index.html

Requirements

# A computer with a BIOS that allows booting from a USB port.
The computer MUST have an option to boot off of a USB device. I can't help you identify whether your computer has this capability or not. Please refer to your system documentation for this
I used a Dell Precision Workstation 450 Series that has a Phoenix ROM BIOS Plus version 1.10 revision A03.
# A running Linux installation
This linux installation should have programs and utilities to partition your USB flash drive and create file systems, like fdisk, mkfs, etc.. . These programs usually are part of any linux distribution. I used Fedora 9
# The Boot Loader GNU GRUB
This is the boot loader that loads my linux and Windows installations on my computer. I kind of went about doing this the hard way by chosing GNU GRUB to be the boot loader on my USB flash drive, since almost all of the live CD's out there use isolinux as the boot loader. I like using GRUB but I'll also have similar instructions using isolinux shortly.
# The distro that you want to put on and boot from your USB flash drive
In this document, I'll be using the terms "distro', "Linux distribution" or "operating system" interchangeably. I'll use the terms to describe what you are trying to boot into from your USB thumb drive. This can be a copy of a CD/DVD (iso) image if you don't have a CD/DVD ROM that contains the installation files of your favorite distro, or a working OS that runs either from your flash drive or from memory (ramdisk). There is no need to reinvent the wheel here, so the easiest way is to download any of the Linux Live CD's that are available for the different distros and work with those. I used Slax Linux and BackTrack 3, which is based on Slax, and GParted, which is based on Unbuntu. I'm working on getting Helix, which is based on ubuntu, to work and I'm almost there. I'll include the instructions on how to get these distros to boot off of the flash drive in this document
# Of course, the USB drive that you want to make bootable
This drive needs to be big enough to save the distros/operating systems that you want to boot to plus the boot loader files. I used a Patriot Xporter XT 32GB Flash Drive

Summary
# Basically, creating the bootable USB flash drive consists of the following tasks: Partitioning and creating file system(s) on the USB flash drive.
# Copying the boot loader to the master boot record of the USB flash drive.
# Downloading and copying the distro of your choice to the USB flash drive.
# Configuring the boot loader to load the distro of your choice.
Directions

1. Partitioning and creating file system(s) on the USB flash drive.
My Patriot Xporter XT 32GB Flash Drive came with a single 32GB FAT32 partition. For this project, I wanted to change the way the Flash Drive was carved out to the following:
* - One small active partition where the boot loader files are kept. This is formatted with ext3
* - Another patition where I would keep all my linux OS's that I wanted to boot up. This is formatted with ext3
* - A third partition that I can use to put files that I can access from Linux and Windows based computers. This has to be a FAT32 partition since it's the only file system type supported by both operating systems.
A visual representation of this setup looks something like this

--------------------------------------------------
| 5MB | 16GB | 15GB |
| ext3 | ext3 | FAT32 |
--------------------------------------------------

After I created and formatted the partitions the way they are shown above, I couldn't get Windows XP to recognize, assign a letter, or access the FAT32 partition. This is an issue I'm currently working on resolving. I'll post more details on this as soon as I figure out the solution.
It's up to you how you want your flash drive partitioned. The partition where I planned on saving the boot loader files to didn't have to be on its own. The whole drive could be one big partition. I wanted the boot loader files to be on its own partition because I thought that was a much cleaner setup. Besides, depending on the distro used, the boot loader's directory and files names may conflict with the distro's directory names and files. Therefore it's better to have them in differnet partitions

So, on with carving out the USB flash drive.
* Plug in your USB flash drive to your computer running linux and note the device that the operating system assigns to the drive.
You may want check your systems log files to figure out what the OS assigned drive is. On my system, this was /dev/sdc . Since the drive already had one big FAT32 partition, /dev/sdc1 was also created by the OS when the flash drive was plugged in. This of course may be different on your system, so check the system log files.
I'll be using /dev/sdc or /dev/sdcx to refer to my usb flash drive throughout this document. Make sure you use the correct device name that refers to yours
* Use fdisk to setup the paritions on the USB flash drive
The commands I ran are in bold and my comments are in bold and italics below:

# fdisk /dev/sdc

The number of cylinders for this disk is set to 391577.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 51 391578 31322176 c W95 FAT32 (LBA)

---Begin: Deleted the existing partition ------
Command (m for help): d
Selected partition 1
---End: Deleted the existing partition ------

---Begin: Creating the first primary partition of 5MB ------
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391577, default 1): # hit [Enter] here
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391577, default 391577): +5M
---End: Creating the first primary partition of 5MB ------

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 1 62 4944 83 Linux

---Begin: Making the first partition bootable ------
Command (m for help): a
Partition number (1-4): 1
---End: Making the first partition bootable ------

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 62 4944 83 Linux

---Begin: Creating the second partition ------
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (63-391577, default 63): # Hit [Enter] here
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-391577, default 391577): +16384M
---End: Creating the second partition ------

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 62 4944 83 Linux
/dev/sdc2 63 200063 16000080 83 Linux

---Begin: Creating the third partition ------
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (200064-391577, default 200064): # Hit [Enter] here
Using default value 200064
Last cylinder or +size or +sizeM or +sizeK (200064-391577, default 391577): # Hit [Enter] here
Using default value 391577
---End: Creating the third partition ------

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 62 4944 83 Linux
/dev/sdc2 63 200063 16000080 83 Linux
/dev/sdc3 200064 391577 15321120 83 Linux

---Begin: Changing the 3rd partition's type to FAT32 ------
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): c
Changed system type of partition 3 to c (W95 FAT32 (LBA))
---End: Changing the 3rd partition's type to FAT32 ------

Command (m for help): p

Disk /dev/sdc: 32.0 GB, 32078036992 bytes
5 heads, 32 sectors/track, 391577 cylinders
Units = cylinders of 160 * 512 = 81920 bytes
Disk identifier: 0xc0620719

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 62 4944 83 Linux
/dev/sdc2 63 200063 16000080 83 Linux
/dev/sdc3 200064 391577 15321120 c W95 FAT32 (LBA)

---Begin: Saving the new partition information ------
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
---End: Saving the new partition information ------

#

* Next, the file systems were created.

---Begin: Creating ext3 file systems on the first and 2nd partitions ------
# mkfs -t ext3 /dev/sdc1
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1240 inodes, 4944 blocks
247 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=5242880
1 block group
8192 blocks per group, 8192 fragments per group
1240 inodes per group

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


# mkfs -t ext3 /dev/sdc2
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1001712 inodes, 4000020 blocks
200001 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4097835008
123 block groups
32768 blocks per group, 32768 fragments per group
8144 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
---End: Creating ext3 file systems on the first and 2nd partitions ------

---Begin: Creating FAT32 file system on the 3rd partitions ------
# mkfs.msdos -v -F 32 /dev/sdc3
mkfs.msdos 2.11 (12 Mar 2005)
/dev/sdc3 has 5 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 30642240 sectors;
file system has 2 32-bit FATs and 16 sectors per cluster.
FAT size is 14948 sectors, and provides 1913269 clusters.
Volume ID is 498de6ce, no volume label.
---End: Creating FAT32 file system on the 3rd partitions ------

* Creating mount points
With partitioning and file systems creation done, I ended up with /dev/sdc , /dev/sdc1, /dev/sdc2, and /dev/sdc3.
I created two directories that will be used as mount points for the first and second partitions of the USB flash drive.

# mkdir -p /mnt/usb1 --- This will be the mount point for the first partition
# mkdir -p /mnt/usb2 --- This will be the mount point for the second partition

2. Copying the boot loader to the master boot record of the USB flash drive.
This is the most important step in this document. Here, the boot loader files are copied from your current running linux system, which is booted using GNU GRUB, to your USB flash drive
Then GRUB is used to install itself on the master boot record (MBR) of the USB flash drive
The commands I ran are in bold and my comments are in bold and italics below:

# mount /dev/sdc1 /mnt/usb1
# mkdir -p /mnt/usb1/boot
# cp -r /boot/grub /mnt/usb1/boot
# grub
Probing devices to guess BIOS drives. This may take a long time.


GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> find /boot/grub/stage1
find /boot/grub/stage1
(hd1,0)
The command above is try to find out all the drives that have /boot/grub/stage1 installed.
Since we copied the GRUB boot loader files before, in theory, the output of this command
should list both my hard drive where liunx is already installed AND my USB flash drive
where I copied the files to.
In reality, the output may list one, all, or none of the drives that has /boot/grub/stage1 installed.
I was lucky to have grub find the files on my USB flash drive's first partition (hd1,0). Another
computer I tried listed my hard drive's first partition (hd0,0) and not my USB flash drive . Your
output may also differ. In general, your hard drive will be (hd0) and unless your have another
hard drive installed, your USB flash drive should be (hd1). The "geometry" command below should
give us more details as to which drive we are dealing with.

grub> geometry (hd1)
geometry (hd1)
drive 0x81: C/H/S = 391577/5/32, The number of sectors = 62652416, /dev/sdc
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 2, Filesystem type is fat, partition type 0xc
grub> geometry (hd0)
geometry (hd0)
drive 0x80: C/H/S = 4863/255/63, The number of sectors = 78125000, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type is ext2fs, partition type 0x83
Partition num: 6, Filesystem type unknown, partition type 0x8e
grub's "geometry" commands prints out information about the drive specified. As shown above, I ran this
command against both (hd1) and (hd0) just to make sure which drive I'm dealing with. My "geometry (hd1)"
output, shows me that I have 3 partitions, so it's likely that hd1 is my USB flash drive. The end of the
line that begins with "drive 0x....." leaves no doubt that it is, since /dev/sdc is infact my USB flash
drive.
So, hd1 is my USB flash drive. Now what?

First, I need to set GRUB's root device to be the partition on my USB flash drive that contains the boot directory.
This is done with grub's "root" command.
grub> root (hd1,0)
root (hd1,0)
Filesystem type is ext2fs, partition type 0x83

Then, I need to install GRUB's boot loader on the master boot record of that drive.
This is done with grub's "setup" command.
grub> setup (hd1)
setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.

If the previous commands were successful, then quit gurb
grub> quit
quit

#

Optional: Change the permissions on the grub directory on the USB flash drive so that everyone has full permissions
# chmod -R 777 /mnt/usb1/boot/grub
Optional: Make a copy of your grub.conf file
# cd /mnt/usb1/boot/grub
# cp -p grub.conf grub.conf.orig


3. Test1: Booting off of your USB flash drive
This will test whether the previous step has made the USB flash drive bootable.
We will not attempt to boot a distro off of the USB flash drive here. At least not just yet.
We will, however, attempt to boot off of the USB flash drive and display a test GRUB boot menu.

# cd /mnt/usb1/boot/grub
# cat grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,5)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,5)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.12-78.2.8.fc9.i686)
root (hd0,5)
kernel /vmlinuz-2.6.27.12-78.2.8.fc9.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.27.12-78.2.8.fc9.i686.img
.....
.....

The above is my original truncated grub.conf file on my USB flash drive. This of course is the same as the
grub.conf on the computer I copied the GRUB boot loader files from. We are going to make some changes to
this file to make it different enough that we know we are booting off of the USB flash drive and not the
computer's hard drive.
The lines starting with # are all comments and are ignore by grub.
We are going to change any mention of (hd0,5), which is where the GRUB files are located on my hard drive
to refer to the first partition of the USB flash drive, which is where the USB flash drive's boot loader
files are located. When booting off of the USB flash drive, it becomes first drive and the computer's hard
drive becomes the second drive. In grub, (hd0,0) means the first partition of the first drive. We will also
change the title and timeout options so that there is not doubt that we are booting off of the USB flash drive.
So, using your favorit text editor, edit and save the grub.conf file so that it looks like the following.
The changes I made are in blue below:

# cat /mnt/usb1/boot/grub/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,5)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title USB Flash Drive First Option
root (hd0,5)
kernel /vmlinuz-2.6.27.12-78.2.8.fc9.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.27.12-78.2.8.fc9.i686.img
.....
.....


Now restart your computer with the USB flash drive plugged in and try to boot off of it.
You should see a grub menu with the first option reading "USB Flash Drive First Option".
If that's the case, then your USB flash drive is bootable!
Reboot your computer off of your hard drive back into your linux operating system.
The next steps will make it possible to boot into a distro saved on your USB flash drive.
This requires saving the distro's files and directories to the correct location and modifying
the grub.conf file.

4. Booting off of your USB flash drive into a distro stored on it
On your computer running linux, mount the partition that contains your GRUB boot loader files and the partition where you're going to be saving the distro's files
In my case, these were /dev/sdc1 and /dev/sdc2 respectively.

# mkdir /tmp/usb1
# mkdir /tmp/usb2
# mount /dev/sdc1 /tmp/usb1
# mount /dev/sdc2 /tmp/usb2

Booting into a distro stored on USB flash drive entails saving the distro's files and directories in the right location on the drive's 2nd partition and modifying the grub.conf file in the first partition. All of the linux installation and Live CD's that I downloaded and used here, used isolinux as their boot loader. The structure of the directories and files on the distro's CD/DVD, with the exception of the directories that contain the kernel and initrd files, has to be exact on the USB flash drive's root directory.
So for example, if a distro's CD/DVD root directory structure looked like the following:

boot/ directory1/ directory2/ file1 file2

Let's assume that boot/ contained the kernel and initrd files. Then the root of the USB flash drive's
2nd partition must have directory1/ , directory2/ , file1 and file2 . boot/ can be located elsewehere
on the USB flash drive's 2nd partition, as long as the grub.conf in the 1st partition has the path to its
files mentioned correctly. I'll explain this more in detail later in this step.

The issue with having to maintain these files and directories structures is that you run into the possibility of having conflicting file names if you have more than one distro saved on the 2nd partition that you want to boot into. Luckily, some of the distro providers did a great job in organizing the files and directories into one top level directory, as is in the case of Slax and Back Track. Unfortunately, it's not as neatly structured in other distros.
GRUB and isolinux menus use different syntax when loading the kernel and passing it parameters. Luckily, changing the syntax from one to the other is relativley simple.

Here is an example of an isolinux menu syntax for a boot menu item:

LABEL menu1
MENU LABEL My Test Menu Item
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;telinit~4

This is the exact same configuration in grub's syntax:

title My Test Menu Item
root (hd0,1)
kernel /boot/vmlinuz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;telinit~4
initrd /boot/initrd.gz


Basically, the "initrd=/some/path" in isolinux becomes a line by itself in grub.conf and changed to "initrd /some/path"
Everything else on the "APPEND" line in isolinux is copied and pasted after "kernel /boot/vmlinuz" in grub.conf
The "LABEL" and "MENU" lines in isolinux are combined into one "title" line in grub.conf
The all important "root (hdx,y)" must exist in grub.conf . This always refer to the partition containing the distro files

So where is the isolinux menu configuration file kept?
This is usually in the file isolinux.cfg. Use find to locate where the file is.
Sometimes isolinux.cfg would contain a line that references another file. This looks something like:

INCLUDE /somepath/somefile.cfg

In this case, /somepath/somefile.cfg will contain the isolinux menu configuration parameters.

So, Let's put this all together:
* Create a directory in the root of the USB flash drive's 2nd partition. Let's call it "myboot"
This directory will be used to store the other directories that contain the kernel and initrd files

# cd /tmp/usb2
# mkdir myboot

* Download and/or mount the CD/DVD image of the distro.
Using a BackTrack ISO image as an example:

# mkdir /tmp/ISO
# mount -o loop bt3final_usb.iso /tmp/ISO

Luckily, BackTrack neatly organizes all the of its files into two directories, BT3/ and boot/. boot/ is where the kernel and initrd files are kept, so it can be moved and renamed. BT3/ , has to be copied over into the root of the USB flash drives 2nd partition:

# rsync -ravz /tmp/ISO/BT3 /tmp/usb2/
# cd /tmp/usb2/myboot/
# mkdir bt3
# rsync -ravz /tmp/ISO/boot/* /tmp/usb2/myboot/bt3/

* Locate the isolinux.cfg file and change the syntax in your grub.conf according to the guidelines mentioned above.
Using the BackTrack example, the isolinux.cfg file is in the directory /tmp/usb2/myboot/bt3/isolinux . Let's take the following entry from isolinux.cfg:

LABEL xconf1
MENU LABEL BT3 Graphics mode (KDE)
KERNEL /boot/vmlinuz
APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm

Open your grub.conf file in /tmp/usb1/boot/grub/ using your favorite text editor.
In grub's syntax, the above entry becomes the following. Please note how we changed
the path to the kernel and initrd files to reflect our changes from the previous step:

title BT3 Graphics mode (KDE)
root (hd0,1)
kernel /myboot/bt3/vmlinuz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
initrd /myboot/bt3/initrd.gz

Save your changes to grub.conf . Reboot and try booting off of your USB flash drive into this new distro.

Renewing the self-signed certificate for Exchange Server 2007

from http://exchangepedia.com/blog/2008/01/exchange-server-2007-renewing-self.html

Exchange Server 2007 issues itself a self-signed certificate for use with services like SMTP, IMAP, POP, IIS and UM. The certificate is issued for a period of one year.

The self-signed certificate meets an important need - securing communication for Exchange services by default. Nevertheless, one should treat these self-signed certificates as temporary. It's not recommended to use these for any client communication on an ongoing basis. For most deployments, you will end up procuring a certificate from a trusted 3rd-party CA (or perhaps an internal CA in organizations with PKI deployed).

However, should you decide to leave the self-signed certificate(s) on some servers and continue to use them, these need to be renewed - just as you would renew certificates from 3rd-party or in-house CAs.

- To renew the certificate for server e12postcard.e12labs.com, a server with CAS and HT roles installed:

Get-ExchangeCertificate -domain "e12postcard.e12labs.com" | fl
Note the services the certificate is enabled for (by default: POP, IMAP, IIS, SMTP on CAS + HT servers). Copy the thumbprint of the certificate.

Get a new certificate with a new expiration date:

Get-ExchangeCertificate -thumbprint "C5DD5B60949267AD624618D8492C4C5281FDD10F" | New-ExchangeCertificate
If the existing certificate is being used for SMTP, you will get the following prompt:

Confirm
Overwrite existing default SMTP certificate,
'C5DD5B60949267AD624618D8492C4C5281FDD10F' (expires 8/22/2008 7:20:34 AM), with certificate '3DA55740509DBA19D1A43A9C7161ED2D0B3B9E3E' (expires 1/28/2009 7:37:31 AM)?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):
Type y to continue. A new certificate is generated.


Thumbprint Services Subject
---------- -------- -------
3DA55740509DBA19D1A43A9C7161ED2D0B3B9E3E ..... CN=E12Postcard
The new certificate is generated and enabled. Examine the new certificate:

Get-ExchangeCertificate -thumbprint "3DA55740509DBA19D1A43A9C7161ED2D0B3B9E3E" | fl
- The old certificate is enabled for IIS, POP, IMAP and SMTP. The new certificate generated using the above command is enabled only for POP, IMAP and SMTP - IIS is missing.

To enable the certificate for IIS:

Enable-ExchangeCertificate -thumbprint "3DA55740509DBA19D1A43A9C7161ED2D0B3B9E3E" -services IIS
This enables the certificate for IIS (in addition to any other services it may already be enabled for - it adds to existing values of the services property).

- Test services are working with the new certificate. If it works as expected, the old certificate can be removed:

Remove-ExchangeCertificate -thumbprint "C5DD5B60949267AD624618D8492C4C5281FDD10F"

Thursday, June 4, 2009

Periodic upload of router configuration

from http://blog.ioshints.info/2007/08/sample-configuration-periodic-upload-of.html?showComment=1239216120000 we read this solution:

To get an IOS device to upload it’s configuration periodically to an external FTP server:

ip ftp source-interface loopback 0
ip ftp username ftp_username
ip ftp password ftp_password
file prompt quiet
!
kron policy-list backup
cli copy running-config ftp://10.20.30.40
!
kron occurrence daily-backup at 0:30 recurring
policy-list backup