Thursday, December 24, 2009

How to shutdown and reboot remote machine via cmd

Examples for Shutdown switch

shutdown /s /m file://testserver/ - Shuts down a remote machine called 'testserver'
shutdown /r /m file://testserver/ - Reboots a remote machine called 'testserver'

Shutdown - with extra switches

/t for time (In seconds and Maximum value is 600secs)
/f for force (to force the reboot or shutdown)
/c for comment (to add comments)

Also, Click Here for A collection of shutdown commands for most DOS and Windows OS.

How to display system info via command line

This command gives you a hard copy of the information displayed in System Information (Accessories). From the command prompt type: Systeminfo > server.txt Then Notepad server.txt lets you read the data captured. The > 'greater than' is an old trick to redirect information from the screen into a file.


Systeminfo - pipe O/S details to a text file
 
For example:   
 
systeminfo > c:\systeminfo.txt

output info to a pipe file

Host Name: 6LMKK1S
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 3 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: fzi
Registered Organization: fzi
Product ID: 76487-641-0311207-23721
Original Install Date: 18/08/2009, 3:54:09 PM
System Up Time: 8 Days, 21 Hours, 23 Minutes, 9 Seconds
System Manufacturer: Dell Inc.
System Model: OptiPlex GX620
System type: X86-based PC
Processor(s): 1 Processor(s) Installed.
[01]: x86 Family 15 Model 4 Stepping 7 GenuineIntel ~2793 Mhz
BIOS Version: DELL - 7
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (GMT+10:00) Canberra, Melbourne, Sydney
Total Physical Memory: 2,038 MB
Available Physical Memory: 1,185 MB
Virtual Memory: Max Size: 2,048 MB
Virtual Memory: Available: 2,008 MB
Virtual Memory: In Use: 40 MB
Page File Location(s): C:\pagefile.sys
Domain: test.com.au
Logon Server:
Hotfix(s): 154 Hotfix(s) Installed.NetWork Card(s): 1 NIC(s) Installed.
[01]: Broadcom NetXtreme Gigabit Ethernet
Connection Name: Local Area Connection
DHCP Enabled: Yes
DHCP Server:
IP address(es)
 

How to find out what group an ADS computer is member of

To find out what groups an ADS computer is a member of:


          dsquery computer -name computername

C:\>dsquery computer -name 6lmmk1s
"CN=6LMKK1s,OU=Admin,OU=Informartion Technology,DC=sca,DC=nsw,DC=gov,DC=au"

Wednesday, December 23, 2009

How to find out detailed information about a user account

How to find out detailed information about a user account:


     net user username /domain

For example, to find the detailed information about a user FZI, enter the below command:

    net user fzi /domain

The command will generate the following below information:

The request will be processed at a domain controller for domain test.com.au
User name FZI
Full Name Fawad Zikria
Comment Information Technology Infrastructure Specialist
User's comment
Country code                 000 (System Default)
Account active                Yes
Account expires              Never
Password last set            12/23/2009 9:58 AM
Password expires            1/22/2010 9:58 AM
Password changeable       12/25/2009 9:58 AM
Password required Yes
User may change password Yes
Workstations allowed        All
Logon script                      slogic.bat
User profile
Home directory
Last logon                           12/23/2009 1:47 PM
Logon hours allowed           All
Local Group Memberships  *Account Operators         *Print Operators                                        
Global Group memberships *CSS_Security                  *Contribute_Users
                                           *Domain Admins               *Citrix_Environment_Gr
                                           *SUN5                             *RSA
                                           *BREACH_DB_READ    *AACO_IT_Admin
                                           *DAR_EDIT                     *Domain Users
                                           *VM_Admin                     *Trim_Context_INFOWORK
                                           *Specialist file exten           *INCIDENT_MANAGEMENT
                                           *CTX-APP-COGNOS     *CTX-APP-GISTEST
The command completed successfully.

How to get list of machines by OS type from Active Directory

To list of all computers that have a Windows XP OS use the following below command:

dsquery * domainroot -filter "(&(objectCategory=computer)(operatingSystem=Windows XP*))"
 
To list of all computers that have a Windows Server OS use the following below command:


dsquery * domainroot -filter "(&(objectCategory=computer)(operatingSystem=Windows Server*))"

How to change the NIC assiociation in ESX 3.5

To change the NIC assiociation, the existing NIC must be unlinked by typing the following command at the service console:

       esxcfg-vswitch -U vmnic# vSwitch#

In this example, say we want to unlink the NIC vmnic0 from vswitch0, so in this example the appropriate command would be:

      esxcfg-vswitch -U vmnic0 vswitch0

Use the following below command to assiociate a new NIC with the vSwitch:

        esxcfg-vswitch -L vmnic# vSwitch#

For Example, if you want to assiociate vmnic1 with vswitch0 then the appropriate command would be:

        esxcfg-vswitch vmnic1 vswitch0

How to Review Service Console Configuration ESX 3.5

Service Console to ESX host and enter the following command:

     esxcfg-vswitch -l

Monday, December 21, 2009

Using dsquery to find the domain controllers in the domain or forest

To find all the domain controllers in the forest with DN and RDN:

    DsQuery Server -o rdn -Forest
    DsQuery Server -Forest

To find all the domain controllers in a domain:
  DsQuery Server -domain domain_name.com

To list all the domain controllers in a domain that are also Global Catalog Servers:
   DsQuery Server -domain domain_name.com -isgc

To list the domain controller in the forest that holds the Schema FSMO:
DsQuery Server -Forest -hasfsmo schema

How to check if a newly created gpo updated on the all domain controllers

Open the command prompt on a domain controller where you created the new gpo and execute the followinng command:

              gpotool.exe /gpo:Newly_Created_GPO_Name_Here /verbose


If the policy has replicated to all the domain controllers, you will see a "Policy Ok" message. If it has not replicated accross yet, then the tool will list the names of the domain controllers who has not received this GPO yet.

Thursday, December 17, 2009

How to Get Clustered Mailbox Server Status

Type the below command at Exchnage commandlet:
Get-ClusteredMailboxServerStatus

Output Screen:
Get-ClusteredMailboxServerStatus
Identity : MailBoxServer

ClusteredMailboxServerName          : MailBoxServer.test.com.au
State                                                 : Failed
OperationalMachines                         : {EX02 , EX03}
FailedResources                                : {/ -- Failed}
OperationalReplicationHostNames     : {ex02, ex03}
FailedReplicationHostNames             : {}
InUseReplicationHostNames             : {ex02, ex03}
IsValid                                              : True
ObjectState                                      : Unchanged

WARNING: One or more resources are in the failed or offline (i.e. stopped or dismounted) state. Please check the event log for more details.

How to find out Exchnage 2007 Version

Run the command in an Exchange Management Shell prompt:

Get-ExchangeServer | fl name,edition,admindisplayversion

Managing Terminal Services Sessions Remotely (Window xp and 2003)

Windows XP and 2003 have two command-line tools which is called qwinsta and rwinsta that can query and reset a remote session.


For example, let's say that I can't gain access to a server using Terminal Services because both sessions are used up. I can use another server to check the status of the first one. As long as the user has administrative rights on the non-accessible machine I would run this:

qwinsta /server:testserver

Where testserver is the name of the non-accessible machine.

The above command will display the following below information:

> qwinsta /server:testserver

SESSIONNAME     USERNAME        ID            STATE         TYPE        DEVICE
console                                                   0              Conn             wdcon
rdp-tcp                                           65536              Listen            rdpwd
rdp-tcp#470              fzi                          1             Active            rdpwd
rdp-tcp#470              grg                        3              Active            rdpwd
Now I know that fzi and grg are the two that are logged in. To disconnect either user session I would type this:

rwinsta /server:testserver 1 or 3 (depending which user session you want to terminate)

Notice the 1 or 3 which is the session ID we found from using qwinsta command above.
 
Or you can try and logoff the session remotely using two Windows utilities, quser.exe and logoff.exe. With quser you can find out the session names of the logged on users and use that information in a subsequent call to logoff.exe to close the session.
 
> quser /server:testserver
 
USERNAME    SESSIONNAME          ID        STATE         IDLE TIME      LOGON TIME
pjp                    rdp-tcp#5                       2          Active                    2:31        12/11/2009 3:39
PM

>logoff rdp-tcp#5 /server:testserver

Tuesday, December 1, 2009

Exchange 2007 - Get-TransportConfig

Using the Get-TransportCofig command will provide the following information:

ClearCategories : True
DSNConversionMode : UseExchangeDSNs
GenerateCopyOfDSNFor : {5.4.8, 5.4.6, 5.4.4, 5.2.4, 5.2.0, 5.1.4}

InternalSMTPServers : {}

JournalingReportNdrTo : <>

MaxDumpsterSizePerStorageGroup : 18MB

MaxDumpsterTime : 7.00:00:00

MaxReceiveSize : unlimited

MaxRecipientEnvelopeLimit : 5000

MaxSendSize : unlimited

TLSReceiveDomainSecureList : {}

TLSSendDomainSecureList : {}

VerifySecureSubmitEnabled : False

VoicemailJournalingEnabled : True

WritingBrandingInDSNEnabled : True

Xexch50Enabled : True

LegacyMailbox on an Exchange 2007

If you happen to have a LegacyMailbox on an Exchange 2007 server, you can upgrade or convert it to a User Mailbox by using the following shell command:

Set-Mailbox -id Existing-Mailbox -ApplyMandatoryProperties

"Existing-Mailbox” stands for the Alias of the mailbox owner, which is effected by the Legacy MailBox

issue. The whole process few take few seconds to covert the Legacy Mailbox to User MailBox.

Command you use to add mailbox permissions

You can use the below command to add mailbox permissions:

Add-MailboxPermission -Identity "Some User" -User Fawad Zikria -Accessright Fullaccess -InheritanceType all