Recently I had to the opportunity to work with a customer who inherited two Citrix Netscaler appliances that they were hoping to use to load balance thier production web environment. This was an excellent idea which would replace Microsoft NLB clustering on thier existing web servers and give them must more functionality. One of the caveats though, to inherting equipment is that you are inheriting the configuration that was on the box previously as well. Sometimes pulling all the little hidden bits of config out takes twice as long as actually setting the new one up. So I ran across a few bits of information on the web to help clean everything out to have your appliance like new again.<!--more-->

First things first! You may be in a situation where you do not have the old login credentials to the box, no sweat a few commands and you are on your way. I pulled this from Citrix's site but will post it again here just in case some of you stumble across this first. The citrix article can be found here (<a href="http://support.citrix.com/article/ctx109006">http://support.citrix.com/article/ctx109006</a>). Keep in mind when reading below that <strong>u@h$</strong> represents the prompt and should not be entered.
<blockquote>1.  Attach a console cable to the Serial Console (9600 baud, 8 bits, 1 stop bit, No parity) of the NetScaler appliance.

2.  Restart the NetScaler appliance.

3.  Press any of the following keys, as prompted:

Press <strong>Spacebar</strong> when the following message is displayed:

Hit [Enter] to boot immediately, or any other key for command prompt Booting [kernel] in 10 seconds
Press <strong>Ctrl</strong> and <strong>C</strong> keys simultaneously when the following message is displayed:
Press [Ctrl-C] for command prompt, or any other key to boot immediately.
Booting [kernel] in 2 seconds...

4.  To start the appliance kernel on a single user mode, enter the following command:

<strong>boot –s</strong>

<strong>Note</strong>: If <strong>boot -s</strong> does not work, then try <strong>reboot</strong> <strong>-- -s</strong> and appliance will reboot in single user mode.

5.  Press Enter when the following message is displayed:
Enter full pathname of shell or RETURN for /bin/sh:
<strong>Note</strong>: Notice that the prompt of the appliance changes to u@h$.

6.  Run the following command to check the disk consistency:

<strong>u@h$ /sbin/fsck /dev/ad0s1a</strong>

7.  Run the following command to display the mounted partitions:

<strong>df</strong>

8.  Run the following command to mount the flash drive:

<strong>u@h$ /sbin/mount /dev/ad0s1a /flash</strong>

If the preceding command fails to mount the flash drive, then run the following command to create the flash directory and then run the preceding command again to mount the drive:
<strong>u@h$ mkdir /flash</strong>

9.  Run the following command to change to the nsconfig directory:
<strong>u@h$ cd /flash/nsconfig</strong>

10.  Run the following set of commands to rewrite the ns.conf file and remove the set of system commands defaulting to the nsroot user:

a. Run the following command to create a new configuration file that does not have commands defaulting to the nsroot user:
<strong>u@h$ grep –v “set system user nsroot” ns.conf &gt; new.conf</strong>

b. Run a command similar to the following command to make a backup of the existing configuration file:
<strong>u@h$ mv ns.conf old.ns.conf</strong>

c. Run the following command to rename the new.conf file to ns.conf:
<strong>u@h$ mv new.conf ns.conf</strong>

11.  Run the following command to restart the appliance:
<strong>reboot</strong>

12.  Log in to the appliance by using the default nsroot user credentials.

13.  Run the following command to reset the nsroot user password of your choice:
<strong>&gt; set system user nsroot &lt;New_Password&gt;</strong></blockquote>
One last thing I thought I would throw in here... The other commands up top tell you how to change things password related, but once you truly have console access and have your password reset you can totally blow away all of the config simply by doing the following.
<blockquote>Issue the following command from the NetScaler CLI:

<strong>&gt; clear config –c y </strong>

-Or-

1. Go to the shell.

2. Under the <strong>/nsconfig</strong> directory, rename <strong>ns.conf</strong> to <strong>ns.conf.bak. </strong>I actually used the move command, so it looked like this<strong> &gt;mv ns.conf ns.conf.old</strong> 

3. Restart the NetScaler. Because there is no configuration in the NetScaler after this restart, it prompts you for the basic configuration.</blockquote>