I came across a situation today where I had to find out the switch details to which a particular server is connected. Often we come across such kind of cases where your network administrator is unavailable to tell you which switch/port it is or data center engineer not around to help you with this information.
After thinking about this problem for sometime, one thing clicked in my mind. I remember in VMWare ESX environment, I used CDP(Cisco Discovery protocol) abilities from Virtual center to find out to which switch a NIC is connected. That means all I need to do is, get this CDP information from the switch to which my server NIC/network connection is connected to. So, the question remained is, how do we send the CDP request to the switch, and how to analyze that data.
I did some googling and realized that I am not alone in this world and there are several people who are having similar requirements for different purposes. Then I started looking for CDP utilities for windows operating system and located one — CDP Monitor from TellSoft. I have seen a few people recommended using this in some forums. I didn’t try it personally but you may want to look at this tool. You can get it from http://www.tallsoft.com/cdpmonitor.htm
I didn’t try this tool directly but while going through the information about this tool, I saw somewhere it is mentioned that this uses WinPCAP and fetches the CDP information from that. Then I thought, if it is using WinPCAP why not use Wireshark to get this information? This tool is already available on my server(because it is a much have tool for any deep dives). I captured the network traffic on the server for sometime using Wireshark and looked for the filters that can show only the CDP information and I am successful. I have got the switch details I needed.
Below is the brief procedure:
- Download and install Wireshark from http://www.wireshark.org/download.html
- Launch Wireshark and start capturing the traffic on interface for which you need to find the swtich and port details.
- Let the capture run for few minutes and then in Filter section type CDP and click on Apply.
- This will show the CDP traffic flow through the server
- Now select the CDP traffic and expand Cisco Discovery Protocol section in packet details pane.
- Here the the Device ID represents the switch name to which your server connected
- And the Port ID represents the ethernet port on switch to which your server is connected
Hmm… I found what I need. I thought documenting this will help other as well and hence authored this port. Feel free to comment.
While researching for some material to prepare my previous article, I stumbled on one of the posts of “Microsoft at work” blog. The post is about best practices to give good life to your battery. The points discussed in the article are interesting and I felt worth sharing it.
You can read the article at http://www.microsoft.com/atwork/maintenance/battery.aspx
At times you may want to include current date & time in a excel sheet. How do you do that automatically?
2 functions help us to do that
- Today() – Inserts current date
This formula will only update when the worksheet is recalculated or when you reopen the workbook. That’s usually not a problem since the date only changes once a day. Also, you may have to format the cell to give you your desired date format.
- Now() – Inserts Current Date & Time
This formula gives you both the date and time in the same cell (i.e. 19-May-03 9:00pm), however, is less useful because the time in the cell won’t change until your worksheet recalculates or when you reopen your workbook. If you just want the cell to display the time only, you’ll have to change the number format by selecting Format, Cells, Number, Time, (select a desired time format), OK
As system administrators we could have received multiple calls from laptop/home users saying that they have forgotten the Local Administrator Password and ask us to crack.
While there are many third party hacking /crack tools on net, below article helped me to do that without any of those.
Here is the article which explains in simple way to reset the password… Hope it would be useful to you sometimes in your operations…
http://www.unp.me/f140/break-administrator-password-of-windows-xp-23706/
Hi Readers,
Before signing out today, I wanna share a quick tip that you can use in windows 7 or windows 2008 computers to open any program with administrator account. That means elevating a applications. You might want to ask, isn’t it easy to right click and say “Run As Administrator”?. Well, that option you won’t get for all applications. Give a try with Office applications if you want to observe this. In such cases, one need to open a elevated command prompt and launch the application from there which is somewhat time consuming. Instead you can use the below tip.
Hold Ctrl + Shift and then click on the application. It will automatically try to open in elevated mode.
Hope this helps and happy learning.
“The attempt to connect to http://ExchangeServer.domain.com/PowerShell using “Kerberos” authentication failed: connecting to remote server failed with the following error message : The WinRM client cannot complete the operation within the time specified. Check if the machine name is valid and is reachable over the network and firewall exception for Windows Remote Management service is enabled. For more information, see the about_Remote_Troubleshooting Help topic.”
You might notice above error message after opening a Exchange Management Console. This error message indicates that connecting to given exchange server using WinRM has failed. Today I received the same error and verified that exchange is doing well on this box. I tried opening the console from different server and it worked file. So, it appeared some sort of profile problem to me.
I did the following to resolve the issue.
- Close Exchange Management Console MMC
- Go to %appdata%\Microsoft\MMC
- Rename “Exchange Management Console” file to “Exchange Management Console.old”
- Launch the console again.
Hope this helps…
Hello Readers,
How many of you regularly use twitter? I guess most of you. Have ever worried about the security it is providing? You should read on if your answer is NO.
One of colleagues gave a quick demo a few days back to show how insecure the default twitter is. His demo proved that, any one sitting in same network as yours can easily hijack your twitter account and tweet on behalf of you. He was able to make it because twitter runs on http by default. Since it is http, all the data transfer will happen over wire in plain text format. So, any one in your network with a couple of tools can spoof your MAC address can easily capture what you are sending over wire and get the twitter cookie(key for maintaining your twitter session) and tweet using your twitter account. The method that my colleague demonstrated is a simple hack any one with computer knowledge can execute it.
How to I make it secure: Twitter provides a option to make your twitter account to use https(secure http) as default protocol. Making use of this will at least prevent your twitter account from this kind of silly hacks.
You can follow the below procedure to enable the https
- Logon to twitter account.
- Go to your profile tab and click on edit profile
- Go to Account section in your profile and check the box Always use HTTPS
- Click on Save and enter your password when prompted

- Now your twitter account is secured.
Do you like one liners in powershell? Here is the quick and easy way to start, stop, restart a service on remote computer. This doesn’t require PowerShell remoting. That means you can use it against any computer which has windows operating system installed.
So far I have authored two articles on managing services using powershell:
- Start/Stop/Restart service on remote computer with powershell
- PowerShell: Start and stop services on remote computer with alternate credentials
The first one I wrote when I was not matured enough with PowerShell and the second one recently to address a specific requirement where user need to pass alternate credentials to manage services.
As most system administrators love to use poweshell one-liners which avoids any external script/module invocation, I want to share this little one which starts, stops, and restarts a service on remote computer.
Start a service on remote computer:
Start-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)
Stop a service on remote computer:
Stop-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)
Restart a service on remote computer:
Restart-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)
Hope these little ones helps.
We want to assign output of a cmdlet/function to a variable so that we can use it in further processing. In scripts it is very inconvenient to debug a issue if the output is going to a variable and not to console. In such cases we can do nothing other than printing the variable value to the console by inserting extra lines of code.
To avoid such inconvenience, powershell has got a way to assign the output to a variable and print to console at the same time. This helped me in quick debugging of my scripts and oneliners.
Ok. Enough explaining about the usage and all and here is how it works.
($service = Get-Service -Name spooler)
Execute the command and you will understand what exactly it is doing. All we need to do it embed the whole command into into brackets like shown above.
Hope this little one helps you. Happy learning.