Monday 21 September 2015

The session cannot be logged out since a device on that session is currently being used.

Just a quick post.

I was just trying to remove an equallogic iscsi target drive and when disconnecting the session received the error...

"The session cannot be logged out since a device on that session is currently being used"

I also noticed that the drive in question caused Windows to be unresponsive when doing anything that required the drives to be enumerated, I.e looking in device manager / my computer.

If you have the same issue the fix is pretty simple


  1. In Disk Management (when it finally loads) right click the disk in question and mark it as offline
  2. In the iscsi initiator software, now disconnect the sessions.

Problem solved.


Thursday 30 May 2013

Configuring Motorola AP6532

Configuring Motorola AP6532

Connect to the AP

By default the Motorola AP6532 is configured to receive an IP address from a DHCP server. The easiest way to connect to the access point in the first instance is to use its zero config IP. To do this, make a note of the last 2 octets of its MAC and convert them to decimal. See below example;

AP MAC: 5C-0E-8B-A7-56-DC
Last 2 Octets: 56-DC
Zero Config: 169.254.86.220

  • Open up windows calculator
  • Goto View à Scientific (XP) or Programmer (Windows 7)
  • Select ‘ HEX’ and type in 1 octet of the MAC
  • Select ‘Decimal’ and the octet will be converted
  • Repeat the above steps for the remaining octet.


In the example above, the IP address will then be as follows: 169.254.86.220

You can then connect to the access point on HTTPS://169.254.X.X

Friday 8 March 2013

Configuring NTP - Windows 2000


Configuring NTP - Windows 2000


Background Info:
The following is a brief guide for configuring a windows 2000 Domain Controller (DC) to synchronize it's time with an external source.

NTP:
The Network Time Protocol (NTP) is used to synchronise the time of a computer or server to another source.

By default all DCs in an AD environment will sync with the Primary Domain Controller (PDC) which will use its internal clock to set the time.

Depending on the environment it may be important to keep your servers and client machines in sync with a public time source – for example, if you host external web services that require authentication.

Assess Your Environment

Kerberos only allows for authenticating machines to be out by 5 minutes. If your servers are out from 'real time' (i.e, the source you want to synchronise to) by more than this amount then you may encounter authentication issues with client machines. If this is the case follow the steps below

Manually change the time on your PDC with 1 minute increments. After each increment connect to each DC and run the following command
  • ·   Net stop w32time
  • ·   Net start w32time

This will resync the DCs with the PDC

You then need to allow time for the clients to update their time from their local DC before continuing with the increments. Depending on whether the clients are ahead or behind will affect how the resync takes place. If they are ahead they will be immediately set to match the DC. If they are behind, the time skew will be set so that the clock gradually catches up with DC over a period of time.

Configure NTP

Once the time difference between your PDC and 'real time' is small enough and your DCs and clients have updated, you can set the PDC to set its time from an external source such as windows.time.com.

To do this, log on to the PDC and in the registry navigate to;

HKLM>SYSTEM>CURRENTCONTROLSET>SERVICES>W32TIME>PARAMETERS

Set the following
  • ·   Type: NTP
  • ·   Period: SpecialSkew
  • ·   NTPServer: time.windows.com, 0x1
  • ·   LocalNTP: 0

Now open up command prompt and run
  • ·   Net stop w32time
  • ·   Net start w32time
Your PDC should be synchronised with your alternate source.

Thursday 9 February 2012

APC UPS - Installing Network Management Card


Installing and Configuring NMC

Note:

The Device IP Configuration utility supplied by APC can also apply IP addresses to NMCs, however, this method is unreliable, often not finding NMCs and when it does, not always successfully applying the IP Address. The below steps cover how to configure the NMC IP address using the serial cable supplied with the card itself.

Step by Step:

  •          Remove all loads from the UPS.
  •          Turn off the UPS (Power button, front panel)
  •          Remove mains power from UPS
  •          Hold down power button (front panel) for 5 seconds to disconnect battery.
  •          Remove back panel where NMC is to be installed.
  •          Install NMC
  •          Plug UPS back into mains
  •          Connect Serial cable that came with NMC
  •          Attach to laptop
  •          Download and run PuTTY – Telnet Client (or any alternative)
  •          Connect with the following settings
    • Bits per second       9600
    • Data Bits                8
    • Parity                     None
    • Stop bits                1
    • Flow Control            None
  •          Connect and press enter until you are prompted for a username
    • Username: APC
    •   Password: APC
  •          Set IP Address using the following commands;
    • apc> tcpip -i yourIPaddress -s yourSubnetMask -g yourDefaultGateway
    • apc> reboot
    Example;
apc> tcpip -i 159.216.45.39 -s 255.255.254.0 -g 159.216.45.1
apc> reboot

The NMC will now reboot and the IP address should be configured. To test, browse to the IP Address and see if the NMC web interface loads.

APC UPS Outlet Groups

UPS Outlet Groups explained
If you've purchased a UPS and have noticed an 'outlet group' option and are wondering just what the hell it is then read on. If your UPS has outlet groups it means it manages the power to them independently. If you look at the back of your UPS, you should see a label that reads 'group 1' or something similar above 4 of the power sockets. Within the UPS interface you will see 'Main group' and 'group1' which you can shutdown, turn on and restart independently of each other.

One thing to note is that when setting the 'Power Off Delays' for the outlet groups, these are staggered.

Example

You have servers set up with the Powerchute Network Shutdown (PCNS) client. The servers need 6 - 7 minutes to shutdown so you want the UPS to stay on for 10 minutes after initiating the shutdown. You set the Power off Delay for both outlet groups to 10 minutes, the UPS won't turn off for 20 minutes as first it will do 10 minutes for the switched outlet group, then 10 minutes for the main outlet group. 

This to me makes no sense. The logical thing for APC to do would be to set the Power off Delays to count down at the same time. Then if the user wants one to remain on for longer, simply increase the power off delay accordingly. Unfortunately this isn't the case. 

Work Around

A potential work around is to assign all PCNS clients to the switched outlet group regardless of whether they're attached or not. Set the power off delay to what you need for all servers on the switched outlet group and set the power off delay for the main group to 0. The UPS should then do the following.

Countdown Power off Delay for switched = 10 minutes
Countdown Power off Delay for main = 0 (UPS shuts off after 10 minutes).

More things to note

Main Outlet Group (For PCNS clients associated)
  • By default, the Power off Delay is 0 seconds if no PCNS clients are associated.
  • By default, the Power off Delay is 190 seconds if any PCNS clients are associated
  • The Power off Delay is affected by 2 factors
    • The largest cmd file runtime under ‘Configure Shutdown’ in PCNS IF it is greater than 120 seconds
    • The Low Battery Duration IFForce Negotiation’ is applied AND the Low Battery Duration is greater than the Power off Delay

Switched Outlet Group (For PCNS clients associated)
  • By default, the Power off Delay is 0 seconds if no PCNS clients are associated
  • By default, the Power off Delay is 70 seconds if any PCNS clients are associated
  • The Power off Delay is affected by 2 factors
    • The largest cmd file runtime under ‘Configure Shutdown’ – Unlike the MOG, even if the runtime value is less than 120 seconds, it is still applied to the Power off Delay.
    • The Low Battery Duration IFForce Negotiation’ is applied AND the Low Battery Duration is greater than the Power off Delay.

SOG and MOG

  • Power off Delay is not affected by the Shutdown on Battery Event
  • Power off does not auto calculate if the new value is less than the current value
  • Power off Delay is not affected by the CMD file run in ‘Configure Events’

Thursday 2 February 2012

Installing PowerChute Network Shutdown (PCNS) for Virtual Machines using Virtual Management Assistant (VMA)

Background Info:
The following is a step by step guide for configuring virtual machines to auto shut-down using PCNS and the free version of VMWare ESXi. These steps will work also work for the paid licensed version. If you're already familiar with VMware feel free to skip the next paragraph.

VMWho?
If you're completely new to VMWare and don't have the foggiest of where to start or what's what, read on. Firstly you'll need ESXi installing on a server. ESXi acts like an operating system on the server, so instead of booting into windows it will boot into ESXi. If set-up properly you should be able to navigate to the IP address of the Host Server (The server ESXi is installed on) and be greeted with an information page. On this page will be links to download the relevant client to create and manage our virtual machines. In this instance we'll be using the vSphere Client.

VMWare Licensing
There are a few differences between the paid licensed and free licensed versions of ESXi but for the sake of this guide, there is only one that is relevant to us. That is that with the free version, we don't have access to certain things we need to run the shut-down file that comes with PCNS. The paid version should work with PCNS straight out of the box, however there is no reason the below steps won't work with it either.


Software used in this procedure:

Software
Version
OS
Link to Website
VMware vSphere Client
4.1
Windows

VMware ESXi
4.1
N/A
VMA
4.1
VMware ESXi
WinSCP
4.3.6
Windows
PowerChute Network Shutdown
3.0
VMware ESXi



Files used in this procedure:

You will need 3 files for this procedure.

  1. shutdown
  2. shutdownViaSOAPAPICall.pl
  3. host

shutdown comes with PCNS and will be discussed later in the procedure.
shutdownViaSOAPAPICall.pl can be downloaded here: http://communities.vmware.com/docs/DOC-11623
host you need to create yourself with the following simple steps.

  • create a txt file and enter the IP address of your ESXi host server.
  • save the txt file with the name 'host', removing the .txt file extension

For the below procedure to work you must have VMware Tools installed on each Virtual Machine on the ESXi host.


Installing VMA

Install VMware vSphere Client on the machine that is to manage the Virtual Machines.

  1. Log into the host server
  2. Navigate to ‘File à Deploy OVF Template…’




  1. Select the VMA OVF file
  2. Go through the setup wizard



Configuring VMA

If installation was successful, you should have another virtual machine entry with the name you just defined for the VMA.

  1. Right click and power on the VMA
  2. With VMA highlighted, navigate to the console window





Once powered up, the VMA will run through a series of questions, asking you to configure the IP Address, SubNets, Gateway, DNS Servers and hostnames. Complete these as desired. A static IP for the VMA will be required.










You will now need to set the password for the VMA. If you are asked to enter the old password, just press enter.










The VMA set-up should now be complete.










Installing PCNS on VMA


Make sure you have the correct version of PCNS for the VMA. The version you need should say ‘ESXi’ in the file name.

  1. Connect to the VMA using WinSCP
  2. Leave ‘Private key’ file empty and change file protocol to ‘SCP’



If you get a prompt about the host key not matching, press update and it will let you continue.

  1. Copy the installation zip folder to <root> /tmp
  2. Go back to the consol window of the VMA



Press ‘Alt + F2’ and log into the VMA in the console window and type the following commands (commands are case sensitive);

  1. sudo chmod 777 /etc/rc.d
  2. sudo mkdir /etc/rc.d/init.d
  3. cd /tmp
  4. sudo gunzip pcns300ESXi.tar.gz
  5. sudo tar -xvf pcns300ESXi.tar
  6. cd ESXi
  7. sudo ./install_en.sh
Next;

  1. Press any key to display and scroll through the End User License Agreement
  2. Type ‘yes’ to the question;
    • 'Do you agree to the above license terms? [yes or no]'
  3. Press enter to accept the default installation directory
  4. Type yes to the question:
    • 'Are you sure you want to install PCNS to /opt/APC/PowerChute [Yes|No]?'
  5. Type ‘/usr/java/jre-vmware/bin’ to the question:
    • 'Please enter java directory if you want to use your system java or press enter to install the bundled Java:'
Next you will be prompted to enter the ESXi host IP, press ‘q’ to skip this step as we’ll configure this later. Installation of PCNS is now complete.



Configuring PCNS on ESXi

Now we need to add the ESXi host to VMA so that the PCNS software can communicate with it.

  1. Type: vifp addserver <ip address of host machine>
    • EG: vifp addserver 192.168.0.1
  2. Enter the password for the ESXi host when prompted
  3. Type: ‘vifp listservers’
If adding the host server has been successful, you should see the server listed.







Now we need to set-up the PCNS software.

  1. Navigate to https://<ipaddress you defined for VMA>:6547
  2. EG, https://192.168.0.1:6547
  3. Go through the set-up wizard as required
Next

  1. Log into PCNS and navigate to ‘Configure Events’ on the left hand menu.
  2. Select ‘Shut Down System’ on ‘UPS: On Battery



  1. Tick ‘Yes, I want to shut dwon the PCNS operating system.’
  2. Enter how long you wish PCNS to wait whilst the UPS is on battery, before initiating a shutdown.
  3. Navigate to 'Configure Shutdown'.
  4. Enter the following for 'Run this command file (full name)'
    • /opt/APC/PowerChute/group1/bin/shutdown
  5. Enter ‘120’ in the ‘The command file needs this much time to complete (seconds)’ field


Pulling it all together


Next we need to amend the permissions so that we can change the existing shutdown files, as the ones that come with do not work with the unlicensed version of ESXi.

  1. With the VMA highlighted in vSphere, go to the ‘console’ tab
  2. Click in the window to make it active
  3. Press ‘Alt + F2’ to go to the VMA login screen
    • Username: vi-admin
    • Password:
    1. Type the following commands (commands are case sensitive)
      • sudo chown vi-admin /opt/APC/PowerChute/group1/bin/shutdown
      • sudo chown vi-admin /opt/APC/PowerChute/group1/bin/
      • sudo chmod 744 /opt/APC/PowerChute/group1/bin/shutdown
      • sudo chmod 744 /opt/APC/PowerChute/group1/bin/

      vi-admin should now have write access to both the shutdown file and folder.

      1. Edit the shutdownHostViaSOAPAPICall.pl file so that it includes your ESXi hostname and password.
      2. Edit the host file (open with notepad) so that it contains the IP Address of the ESXi host
      3. Using WinSCP, navigate to /opt/APC/PowerChute/group1/bin
      4. Edit the shutdown file and replace the current file path with the following  (all on one line, see below image) ;
      perl /opt/APC/PowerChute/group1/bin/shutdownHostViaSOAPAPICall.pl /opt/APC/PowerChute/group1/bin/host 



      1. Now using WinSCP, copy
        • shutdownHostViaSOAPAPICall.pl
        • and ‘host’ to /opt/APC/PowerChute/group1/bin/
      2. IMPORTANT: Make sure to set the Transfer settings to ‘Text’




      Finally, we need to amend the way the ESXi host manages the virtual machines when it’s told to shutdown. Do the following.

      1. Highlight the ESXi host (left hand side) in the vSphere Client
      2. Navigate to the ‘configuration’ tab (right hand side)
      3. Select ‘Virtual Machine Startup/Shutdown’



      1. Select ‘Properties’ (top right)
      2. tick ‘Allow virtual machines to start and stop automatically with the system’
      3. Set the ‘Default Shutdown Delay’ to 30 seconds
      4. Set the ‘Default Shutdown Action’ to ‘Suspend’ or ‘Guest Shutdown’
      5. Edit the VMA shutdown settings so the shutdown action is ‘Power Off’



      1. Add each of the Virtual Machines to ‘Automatic Startup’, making sure that the VMA is number 1



      Note: The settings detail in steps 13 – 15 (above) are configurable dependant on user preference. There are 3 things that you must do regardless of the settings you apply.

      • Make sure VMA is listed first in automatic startup
      • Make sure you have enough ‘Shutdown Delay’ for the machines to shutdown before the host does.
      • Make sure the VMA is set to power off on shutdown, setting it to suspend will mean the PCNS service will not restart 

      Your Virtual Machines and UPS should now be configured to shutdown automatically in the event of a power outage.