Posts

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)     {   ...

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...

Active Directory NTP

Due to the fact that most Windows authentication operations rely heavily on Kerberos and the significant part that time plays, you should always configure time sources for your active directory forests and domains. In active directory all computers update their time settings from the domains controllers and they in turn update using the domain controller holding the PDC Emulation FSMO role. So you should always verify that your PDC is able to access the extrnal time source. The command I use to check this is  w32tm /stripchart /computer:time.nist.gov.  If you do not get any errors from this command then you're probably set. Another way to check this is to check your firewall's logs after configuring the time settings on PDC. Since a different department may be responsible for the networking, the first way may be the best way to go. One last thing I use do is to run the command on some clients that may have firewalls between them and the domain controllers or to verify N...

Skydrive Crashing

For quite some time now, the Skydrive application on my computer was crushing. I was getting errors in the Application log stating: "Faulting application name: skydrive.exe, version: 6.3.9600.17278". I could also see a lot of Skydrive icons in the tray but they disappeared when I hovered the mouse over them. After some online searched I runned across a post suggesting to use the Onedrive Troubleshooter (you can get it from  here ) to search for problems and reset Onedrive if needed. I ended up resetting and everything is working fine now after an initial sync. There are also some command line switches you can use on skydrive.exe to stop and reset but I haven't used them.

How to get Microsoft Windows system info using Powershell

There are many times that I have to get the system information like Windows Edition, Version, Architecture etc, in order to create support case or post to a forum. Since I use Powershell for almost everything, I have a script with the following commands to get that info: Windows Edition (Get-WmiObject -class Win32_OperatingSystem).Caption Windows Version (Get-WmiObject -class Win32_OperatingSystem).Version Processor Info (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture I'm using WMI cause I want to be able to get the above info from remote systems as well. If you want more information about a system take a look at the Win32_OperatingSystem class  here . If you want to act based on the above info, it may be better to use some environmental variables and get the exact values.

Windows Username to SID mapping

I needed to map the sids of some users to their usernames the other day so I though that I should be able to use WMI to do it. Indeed, you can use the command wmic useraccount get name,sid  that will output a list of usernames and their sids. If you try to run this on Powershell you'll get an error message about invalid GET expression, that is because of the comma. You can use the Start-Process cmdlet and start the command with the necessary arguments.