email
Showing posts with label Tips. Show all posts
Showing posts with label Tips. Show all posts

Tuesday, December 22, 2009

Resolve GPO GUID to GPO name

“I have a GPO GUID and want to know to which GPO this belongs to?”. If that is your question, you can happily use the below method.  For this you need to have “support tools” of Windows 2003.  You can get it from Microsoft Web Site as well. Alternatively, you can copy search.vbs from any machine where support tools package is installed.



cscript /nologo search.vbs "LDAP://dc=mydomain,dc=com" /C:"&(objectClass=groupPolicyContainer)(name={31B2F340-016D-11D2-945F-00C04FB984F9})" /P:displayName /S:SubTree


You can find more other alternatives ways at http://support.microsoft.com/kb/216359


Happy Learning..,
Sitaram Pamarthi


tags:how to find GPO name, GPO GUID to name resolution

Wednesday, December 2, 2009

Problems with opening MMC

While working on some of the MMC related consoles I used to get a error something like below when I try to open the MMC(say dsa.msc or any other).


"MMC cannot open the file . This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you don't have sufficient access rights to the file"
.

When I first came across this issue three years back, I spent numerous amount of time to find the solution and using it successfully since then. Also shared this tip with few of my colleagues who faced this problem. I thought of sharing this with my blog audience to make them not to struggle with this kind of error again.

Solution:

Go to start run and enter the command, “%appdata%/Microsoft/MMC” and click on OK

In the opened folder look for file that matches the mmc name troubling you and renamed it to some like backup and try opening your MMC again. It should work!.

TIP : If you have problems in opening “Active Directory Users and Computers”, you need to deal with the file named dsa.

If you are smart enough and you have old backups of this folder, try to compare the file and see what has changed. It’s just falt file with some values structure in XML. Most probably, you want to look at “MMC_ConsoleFile ConsoleVersion” value. This value should be equivalent to your MMC version. Problem may be different in your case, so compare with backup file to list the diffs which helps in reading the problem.

Happy Learning...,
Sitaram Pamarthi

Tuesday, December 1, 2009

Understanding WMI event notification

Many people aren't aware of this beautiful feature introduced with Windows 2000 and continuing in it's successors. To get a better sense of what it is, lets a take a example. Your CPU is spiking to 100% at mid nights and you got the task of identifying the root cause. The spike is very  sporadic in nature and lasts for very short time. How will you deal with this situation to see which process is taking high CPU?. Here comes the benefit of WMI event notifications. You can trigger a monitoring in your system using WMI event notifications to monitor the CPU utilization and do a process dump when it touches the monitored value. Task is done and you don't need to spend time in monitoring manually. This is just a example only and you can adopt this to get alerted when a process starts or ends.

I may not be good at explaining the real use of WMI event notifications but I have found beautiful blog entry which explained this in detailed. Read it to become smart administrator.

Trevor Sullivan's Tech Room
You can also refer to Microsoft Technet Site Article

Happy Learning..,
Sitaram Pamarthi.

Sunday, October 18, 2009

Eject CD drive in windows using powershell

I have seen some page hits to my blog where people are searching for "power shell code for ejecting CD drive" and landing at my post which describes the procedure using VBscript. So, posting the powershell equivalent code here for such peoples reference.

1. $mycds = (New-Object -com "WMPlayer.OCX.7").cdromCollection
2. $mycds.item (0).eject()

The above code ejects a CD drive. If you have want to close the CD drive repeat the second statement again. If you have multiple CD drives, you need to play with array object in second line to eject/close a specific CD drive.

Happy Learning..,
Sitaram Pamarthi

Thursday, October 8, 2009

How to eject and close CD Drive using VBscript

After reading labnol post, I felt why only Unix and why not windows. I did some search over internet and finally could able to tailer this script.

It works fine if you have only one CD-Drive. If you have multiple CD drives, then explore the options of the Object I am using in this script.

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set ArrCDROM = oWMP.cdromCollection
while (1)
wscript.sleep 3000
ArrCDROM.Item(0).Eject
wscript.sleep 3000
ArrCDROM.Item(0).Eject
wend


Write in comments section if you need any more clarity.

Happy learning..,
Sitaram Pamarthi

Tags: Vbscript for ejecting CD-Drive, CD-Drive eject command, eject CD drive from command prompt.

Thursday, September 24, 2009

Check and terminate process on remote machine using wmi

WMI is a wonderful tool for remote administration!!!

Today in this post, I will demonstrate on how to query and terminate processes in remote machine using wmi command line utility (wmic). Ofcourse, you need have administrator rights on remote machine to run these command(may be a domain admin account is a right choice here).

In all these below examples, "myremote" is my remote machine name against which I am performing these operations.

To query all processes in remote machine use below command..

wmic /node:myremote process

To query a specific process(outlook.exe) in remote machine...

wmic /node:myremote process where name="outlook.exe"

If you are not sure of exact process name but know only few letters of it, then use this...

wmic /node:myremote process where "name like '%outlo%'" get name

To terminate(kill) a process...

wmic /node:myremote process where name="outlook.exe"  call terminate

To query the owner of a process...

wmic /node:myremote process where name="outlook.exe"  call getowner

Enough for today.. :-) I will post more command lines when I get some time...

If you want a command for any specific requirement, please leave a note below in comments section. I will get back to you ASAP.

Happy Learning..,
Sitaram Pamarthi

How to get the CPU utilization of remote machine from command prompt

Use below command if you want to get the CPU utilization of remote machine from command prompt. It's very useful if you don't want to spend time in logging on to the server to verify the stats. Needless to say, replace RemoteMachine with your remote machine name in below command.

typeperf "\\RemoteMachine\processor(_Total)\% Processor Time"

Refer to my old article to know more about typeperf

Happy Learning...,
Sitaram Pamarthi

Tuesday, September 22, 2009

Read-only USB drives

Do you want to make your USB drive as read-only? That means you want to disable write operations to USB?. There is a way to do this if your desktop has windows XP with SP2.

Procedure:
Open regedit and navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\StorageDevicePolicies registry key, and change the value of WriteProtect setting to 1 from 0

If you don't find this registry key in your machine, copy the below code into a text file and save as DisableUSB.reg and execute it with admin rights.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]
"WriteProtect"=dword:00000001

The above code does nothing but creating the required registry keys if they are not already present. You can disable write protection on USB device by setting the value back to '0'. You will get a pop-up like below if you are trying to copy data to a write protected USB drive.



Refer to http://technet.microsoft.com/en-us/library/bb457157.aspx#EAAA for more information

Happy Learning,
Sitaram Pamarthi

Comments and Questions are welcome......!!!

Wednesday, May 20, 2009

Collect performance data from command prompt

While browsing for something, I came across this nice windows built-in tool called, "typeperf". This tool redirects the output of performance counter values to command prompt. The normal way for collecting performance values is to open perfmon and configure the options trough GUI to capture the output into some CSV or other file. But this command line tool is very handly to have the counter results from command line.

If some one asked me to monitor the CPU utilization of remote system, I will simply issue below command in my command prompt(ofcourse I need admin rights on remote machine or the account I am using should be member of permon related groups if the remote machine is of a server OS). This command has most of the options that you can set using perfmon.

c:\> typeperf "\\RemoteMachine\processor(_Total)\% Processor Time"

"(PDH-CSV 4.0)","\\RemoteMachine\processor(_Total)\% Processor Time"
"05/20/2009 20:55:11.402","37.682755"
"05/20/2009 20:55:12.465","12.502240"
"05/20/2009 20:55:13.465","33.825223"
"05/20/2009 20:55:14.559","36.987914"
"05/20/2009 20:55:15.668","21.877000"
"05/20/2009 20:55:16.668","3.127480"
"05/20/2009 20:55:17.668","9.377320"
"05/20/2009 20:55:18.668","6.252400"
"05/20/2009 20:55:19.668","10.939780"


Below is the command help and I know you can build your custom command using this. Let me know if you need any help.

Refer this link for syntax and to have more examples. You can type
"typeperf /?" at command prompt to get help on this command.

I WELCOME YOUR COMMENTS;THAT MAKES ME PERFECT:-)

Happy learning..,
Sitaram Pamarthi.

Saturday, April 18, 2009

Clipboard not working in Windows XP

[Please write in comments session here if this post solves  your clipboard problem]
Many users often complain to their system adminstrator that their clipboard is not working and they are unable to do copy/paste operations and it is the task of sys admins to break their head to find out the reason. Dear sysadmin...no more you need to do that. I came across a good tool which can help you to solve this problem.

This problem generally occurs when a process locks clipboard for reading and writting and didn't release it properly. Clipboard will function normally after killing that process. The tool (GetOpenClipboardWindow) will help you to identify the culprit process. Download this tool now and share it with users.

From my experience, I can say that mostly mstsc.exe is the process which blocks the clipboard. The reason I assume here is simple because it dealts with clipboard of connected computer and your computer.

Happy Learning..,
Sitaram Pamarthi

tags : windows xp clipboard not working, windows XP clipboard problem, clipboard not working, copy and paste not working in windows, windows copy and paste issue

Wednesday, April 8, 2009

How to find the remote machine OS easily

Do you ever got a requirement to findout what Operating System(OS) the remote machines has? You might say, "Ah! I am a sysadmin, it's my daily task". Good, how will you findout the OS, if you don't have any sort of rights(console right/admin rights/ports access) on remote machine?

Hmm..It's simple now!!

You might have many windows and UNIX boxes in your network. If you know one machine name and if you want to find if that machine has windows or UNIX os, try the below steps.

JUST PING IT.

Yes, right. You just ping that machine. If the TTL shows as 127 or less it is windows box and if the TTL shows 254 or less it is a UNIX box.

Test it if you don't believe.

c:\>ping windowsbox

Pinging windowsbox.mydomain.com [172.16.100.10] with 32 bytes of data:

Reply from 172.16.100.10: bytes=32 time=15ms TTL=127
Reply from 172.16.100.10: bytes=32 time<1ms TTL=127
Reply from 172.16.100.10: bytes=32 time<1ms TTL=127

c:\>ping unixbox

Pinging unixbox.mydomain.com [172.16.100.20] with 32 bytes of data:

Reply from 172.16.100.20: bytes=32 time=15ms TTL=254
Reply from 172.16.100.20: bytes=32 time<1ms TTL=254
Reply from 172.16.100.20: bytes=32 time<1ms TTL=254

The thing is that windows machine will return 128 as TTL by default and Unix machine returns 255 as TTL. And this TTL will get reduced by one(TTL --) when there is just one hop between your computer and the remote box. And will get reduced by two when you have two hops...and gets reduced by N where are N hops.

Happy Learning..,
Sitaram Pamarthi

Saturday, March 21, 2009

Configure IE to download multiple files

By default internet explorer allows only two download sessions in parallel which means that you can download only two files at a time and to initate the download of third file, one of your first downloads should be completed/terminated. If you want to have more than two download sessions in IE like firefox, check the below article.
http://support.microsoft.com/kb/282402

~Sitaram Pamarthi

Tuesday, January 20, 2009

Customizing folder view and behavior using Desktop.ini

I am not sure if many people are aware of this or not. But it is possible to customize the way how a folder appears and behaves using desktop.ini . This file has to be configured and placed in the folder which needs to be customized.

A good documentation explaining Desktop.ini file is available at below links

http://www.xs4all.nl/~hwiegman/desktopini.html


http://msdn.microsoft.com/en-us/library/cc144102(VS.85).aspx

Happy learning...
Sitaram Pamarthi

Saturday, January 17, 2009

Add command prompt option to Windows Explorer context menu

I found this very useful because, it takes you to required directory immediately without the need for opening a command prompt from start->Run and changing to required directory using cd command. This option enables you to right-click on any folder in windows explorer and select "Command Prompt"; this opens up a command prompt with that folder as your current directory.

What you need to do to get this option?:

It's very simple, follow any of the below procedures...

A) Manual procedure
Well, you need to have administrator rights to do below registry modifications and I warn you to little bit careful while working on registry because, any improper modifications will lead to registry corruption.

  1. Open registry editor(start -> Run -> Type regedit)
  2. Navigate to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell
  3. Create a new key named "Command prompt here..".
  4. Create a key named "command" under "under newly created above key and set the default value to "cmd.exe /k pushd %1"
  5. Close regedit

B) Automated procedure

Run the following command and it will get the things configured for you :-)

C:\>reg add "HKLM\Software\Classes\Folder\Shell\Command Prompt here...\command"
/ve /t REG_SZ /d "cmd.exe /k pushd %1"

The operation completed successfully

C:\>


Now you right click on any folder and you will observe additional option "Command prompt here..." selecting which results in opening a new command prompt window with current directory as the one you selected. Look at the below screen shot.




If you want to put your own customized name in context menu, then replace "Command Prompt here.." with your own text.