Windows server 2008 – How to find Terminal servers in your domain

Posted by Mark | Posted in Command line, Terminal services, Windows 2008 | Posted on 24-06-2009

0

This post will show you how to find Windows server 2008 with Terminal server role installed in your domain.

To perform search in domain named “Testdomain.com” domain open command line and type:

query termserver /domain:Testdomain.com

win2008_terminals

Press “Enter” and you are done !


Windows server 2003 – How to list all Organizational Units via command line

Posted by aidas | Posted in Active directory, Command line, Windows 2003 | Posted on 17-06-2009

0

This post will show how to list all Organizational Units in your domain using command line tool netdom. To list all OU in domain named “testdomain.com” type:

netdom query /d:testdomain.com OU

Note that netdom is part of Windows server 2003 support tools. They can be found on your OS CD (Support\Tools directory).

Windows server 2003 – How to check FSMO role holders

Posted by aidas | Posted in Command line, Scripting, Windows 2003 | Posted on 14-06-2009

0

I`ll show you two quick ways to check FSMO roles on Windows 2003 server.

1. open command line and type :

netdom query fsmo

2. copy this code to notepad and save as fsmo.vbs script :

Set objRootDSE = GetObject(”LDAP://rootDSE”)

Set objSchema = GetObject _
(”LDAP://” & objRootDSE.Get(”schemaNamingContext”))
strSchemaMaster = objSchema.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Forest-wide Schema Master FSMO: ” & objComputer.Name

Set objNtds = Nothing
Set objComputer = Nothing

Set objPartitions = GetObject(”LDAP://CN=Partitions,” & _
objRootDSE.Get(”configurationNamingContext”))
strDomainNamingMaster = objPartitions.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Forest-wide Domain Naming Master FSMO: ” & objComputer.Name

Set objDomain = GetObject _
(”LDAP://” & objRootDSE.Get(”defaultNamingContext”))
strPdcEmulator = objDomain.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strPdcEmulator)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s PDC Emulator FSMO: ” & objComputer.Name

Set objRidManager = GetObject(”LDAP://CN=RID Manager$,CN=System,” & _
objRootDSE.Get(”defaultNamingContext”))
strRidMaster = objRidManager.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s RID Master FSMO: ” & objComputer.Name

Set objInfrastructure = GetObject(”LDAP://CN=Infrastructure,” & _
objRootDSE.Get(”defaultNamingContext”))
strInfrastructureMaster = objInfrastructure.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s Infrastructure Master FSMO: ” & objComputer.Name

Then open command line and type:

cscript fsmo.vbs



Windows server 2003 and Windows XP – How to add windows user to group

Posted by aidas | Posted in Command line, Windows 2003, Windows XP | Posted on 17-05-2009

0

This post will show you how to add local user to group on your Windows machine. Lets say we want to add local user account “testuser” to group “Administrators”.

1. COMMON WAY

Right click mouse on “My computer” and select “Manage” to open Computer Management window. Expand “Local users and groups” and select “Groups”. In the right pane right click on “Administrators” and select “Properties”.

windows user group

In “Administrators properties” window click “Add…” . Type testuser and hit “Check Names” to verify that user exists on local system. Press “OK” and you are done !

2. ADVANCED WAY

To add “testuser” to “Administrators” group open command line on your Windows machine and type:

net localgroup Administrators testuser /add

Windows server 2003 and Windows XP – How to control remote command line

Posted by aidas | Posted in Command line, Tools, Windows 2003, Windows XP | Posted on 16-05-2009

0

This post will show you how to get control of remote command line using psexec . Psexec is part of “pstools” written by Mark Russinovich and can be downloaded here . Lets say we want to connect to server named “testserver” and get control of its command line. To do it open command line on your Windows server 2003 and type:

psexec \\testserver cmd


Windows server 2003 and Windows XP – How to set service account password via command line

Posted by aidas | Posted in Command line, Windows 2003, Windows XP | Posted on 15-05-2009

0

This post will show you how to notify Windows about service account password change using command line.

Lets say we have service named “Symantec Antivirus” and it runs as local user account named “testuser” (Log On As) . For security purposes we changed password for this user to “NewPassword“. To notify “Symantec Antivirus” that password for its service account was changed open command line and type:

sc config “Symantec Antivirus” password= NewPassword

Note that there is space between equals sign and password value.

Windows server 2003 and Windows XP – How to list DNS servers for your domain via command line

Posted by aidas | Posted in Active directory, Command line, Windows 2003, Windows XP | Posted on 15-05-2009

0

Quick tip for you how to find all DNS servers for your domain. Lets say that we want to list all DNS servers for domain named testdomain.lan . To do it open command line on your Windows server 2003 or Windows XP machine and type:

nslookup testdomain.lan

Windows server 2003 and Windows XP – How to test DNS configuration via command line

Posted by aidas | Posted in Active directory, Command line, Windows 2003, Windows XP | Posted on 15-05-2009

0

This post will show you how to test DNS configuration using command line on your Windows server. To do it open command line and type:

netsh diag show test

This command will perform quick network configuration test by pinging all DNS servers and gateways in your TCP/IP configuration.

Also you can test DNS by runing netdiag tool which is part of Windows Resourse Kit. To diagnose your DNS problems with this tool open command line and type:

netdiag /test:dns

Windows server 2008 – How to reset license activation period via command line

Posted by aidas | Posted in Command line, Windows 2008 | Posted on 14-05-2009

0

By default you have option to use Windows server 2008 for 60 days without activation . Do you know that you can reset this activation period 4 times per installation? In that case actual time of Windows server 2008 usage without activation increases to ~240 days. This post will show you how to reset it. To do it open command line and type:

slmgr -rearm

Windows XP – How to disable fault logging (Dumprep)

Posted by aidas | Posted in Command line, Registry, Windows XP | Posted on 13-05-2009

0

This quick how to will show you the way to ged rid of Dumprep.exe which is responsible for error logging to a file and sending to Microsoft. When serious error hits your system you always get prompt to notify Microsoft by sending error code to it. In some cases this prompting may result performance issues on your system. If you want to disable Dumprep.exe open command line on your Windows XP and type:

REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /V Dumprep /F\

Press Enter.

After that restart your computer.

Windows server 2003 and Windows XP – How to reset Windows time service via command line

Posted by aidas | Posted in Command line, Windows 2003, Windows XP | Posted on 13-05-2009

0

In this short post i will show how to reset Windows time service if it is not working properly on your Windows server 2003 or Windows XP machine. To perform reset open command line ant type:

w32tm /unregister press Enter

w32tm /register press Enter

Windows server 2003 and Windows XP – How to change power management options via command line

Posted by aidas | Posted in Command line, Windows 2003, Windows XP | Posted on 12-05-2009

0

This post will show you how to use command line tool powercfg to change power management options. Lets say we need one power-scheme policy for all our portable computers. In this case we will use command line tool powercfg and create bat script which will be distributed to all portable computers users as logon script. Requirements are:

* power-scheme must be set to “Portable/Laptop”
* plugged in monitor turn off – Never
* on battery monitor turn off – 15 min
* plugged in system standby – Never
* on battery system standby – 25 min
* plugged in hard disks turn off – Never
* on battery hard disks turn off – 45 min

To create script open notepad and type:

REM Set power-scheme to Portable/Laptop
powercfg /setactive “portable/laptop”
REM Set plugged in monitor timeout to Never
powercfg /change “portable/laptop” /monitor-timeout-ac 0
REM Set on battery monitor timeout to 15 minutes
powercfg /change “portable/laptop” /monitor-timeout-dc 15
REM Set plugged in system standby to Never
powercfg /change “portable/laptop” /standby-timeout-ac 0
REM Set on battery system standby to 25 minutes
powercfg /change “portable/laptop” /standby-timeout-dc 25
REM Set plugged in hard disks timeout to Never
powercfg /change “portable/laptop” /disk-timeout-ac 0
REM Set on battery hard disks timeout to 45 minutes
powercfg /change “portable/laptop” /disk-timeout-dc 45

Save file as power.bat and distribute to your notebook users as logon script manually or through group policy

Note that you can type powercfg /? in command line for more power management examples