Posts

Showing posts from December, 2014

Powershell Get MAC Address

Below is a powershell function used to get a list of MAC addresses on a computer using WMI:

function Get-MACAddress
{
<#
    .SYNOPSIS 
     Displays the list of MAC addresses on a computer.
    .DESCRIPTION
     This function lists all MAC addresses on local computer or a remote one using WMI.
    .EXAMPLE
     Get-MACAddress
     This command returns a list of all MAC addresses on the local computer.
    .EXAMPLE
     Get-MACAddress -ComputerName client01 -Credential $cred
     This command returns a list of all MAC addresses on computer 'client01' using the $cred credentials.
#>
    Param
    (
        [string]$ComputerName = ".",
        [system.management.automation.psCredential]$Credential
    )

    if($Credential)
    {
        Get-WMIObject -Class win32_networkadapterconfiguration -ComputerName $ComputerName -Credential $Credential | Where-Object {$_.macaddress.length -gt 0} | Select-Object -Property Description, MACAddress | Format-Table
    }
    else
    {
        Get-WMIObj…

NetScaler IP Address Conflict

I opened up my Citrix Command Center today and I had hundreds of messages regarding IP conflict -on a NetScaler.

In order to resolve this I had to get the MAC address of the machine that creates the conflict, and what better way from the command line.

I fired up Putty and connected to the NetScaler instance facing the conflict. I switched to the linux shell using the shell command and then I run nsconmsg -K /var/nslog/newnslog -d consmsg to get the relevant messages. Be vary careful with the above command and always use capital K.

An other way to get this kind of messages it using the Diagnostics page within the GUI.

Another thing to note is that you should check the HA status if you have two instances and you get the conflict about a VIP. If the IP with the conflict is the NSIP then you should check the network cables or the virtual adapters and the networks you have the connected to.

WAN Emulation using WANEm

Let's say that we have to test some application, that can be a web application, a TCP/IP application or any other kind of connection, in an environment that simulates the WAN.
First of all we have to design the network environment.
Most times, I use a Hyper-V environment to do setup the machines and networks needed for the test.

Lets say that we've already setup a server and a client as virtual machines with names SERVERVM and CLIENTVM respectively. Each has one virtual network adapter.
Now we need to create two new virtual networks, let's name them SERVERNET and CLIENTNET. We connect the client's adapter to the CLIENTNET and server's adapter to SERVERNET.
The next thing we have to do is create the WAN emulation virtual machine. I prefer to user the WANEm emulator. So grab a copy of the ISO and create a new VM. If you are using Hyper-V, remove the Virtual Network Adapter from the VM and add two new Legacy Network Adapters. Connect the adapters to the networks we c…