Thursday, October 21, 2010

Commonly used WMIC Commands

Windows Management Instrumentation Command-line (WMIC), uses the power of Windows Management Instrumentation (WMI) to enable systems management from the command line

lets go through some commonly used WMIC Commands


How to find out Serial no of a system from command prompt

a) wmic csproduct get name,vendor,identifyingNumber

ex:
IdentifyingNumber      Name                   Vendor
99L9891 Latitude D610 Dell Inc.


How to get MAC Address from Command prompt

b) wmic nic get macaddress,description

ex:

Description MACAddress
Infrared Port
Bluetooth Device (Personal Area Network) 00:xxxxxxxxxxx:19
RAS Async Adapter
WAN Miniport (L2TP)
WAN Miniport (PPTP) 50:xxxxxxxxxxx:30



How to get Harddisk model/make details from Command prompt

c) wmic diskdrive get name,size,model

ex:
Model Name Size
Hitachi HTS721080G9AT00 \\.\PHYSICALDRIVE0 80023749120



Find out BIOS Details from Command prompt

d) wmic bios get name,serialnumber,version

ex:
Name SerialNumber Version
Phoenix ROM BIOS PLUS Version 1.10 A06 99L9891 DELL - 27d50a02



Find out Details of Windows updates installed from command prompt

e) wmic qfe get description,installedOn /format:csv

ex:
PCPC3-D610,Security Update for Windows XP (KB929969),3/14/2007
PCPC3-D610,Security Update for Windows XP (KB930178),4/11/2007
PCPC3-D610,Update for Windows XP (KB930916),5/10/2007
PCPC3-D610,Security Update for Windows XP (KB931261),4/11/2007
PCPC3-D610,Security Update for Windows XP (KB931768),5/10/2007
PCPC3-D610,Security Update for Windows XP (KB931784),4/11/2007



Get Partition details of Hard disk from command prompt

f)
C:\>wmic

wmic:root\cli>partition get name,bootable,size,type

ex:

Bootable Name Size Type
TRUE Disk #0, Partition #0 4194860544 Installable File System
Disk #0, Partition #1 9475522560 Extended Partition
TRUE Disk #1, Partition #0 8389753344 Unknown
Disk #1, Partition #1 11630545920 Unknown


How to Install SATA Drivers for enabling SATA native mode in Windows XP

For enabling SATA Native Mode on your computer AFTER installing Windows XP follow the below mentioned steps

Enabling SATA native mode will give you a slight performance increase and slightly increased battery life.

1. Download the Intel Matrix Storage Manager software for your computer from the manufacturer’s web site

2. Run it, by default it will save some files to C:\ before it runs setup and tells you that the software is not supported

3. Accept the license agreement, it extracts some files. The files you’re interested in are now in a “Driver” subfolder of the original folder and include the following :iaahci.cat, iaahci.inf, iastor.cat, iastor.inf, iastor.sys, TXTSSETUP.OEM

4. Now go to Device Manager, under IDE ATA/ATAPI controllers you should see something like : Intel 82801GBM (ICH7-M Family) Serial ATA Storage Controller

5. Right-Click on that and select Update Driver

6. Say no to connecting to Windows Update to search, hit Next

7. Select Install from a list or specific location (Advanced), hit Next

8. Select “Don’t search. I will choose the driver to install”, hit Next

9. Select Have Disk

10. Browse to the Driver folder and highlight the iastor.inf file, hit Open

11. Select OK

12. Now you should have a list of controllers. **WARNING** Selecting the wrong controller for your computer will prevent it to boot, causing BSOD. Make sure you select the right controller for your particular computer !

13. You’ll get warned that installing the device driver is not recommended, click Yes to continue installing

14. Click Finish

15. Click Yes to restart your computer

16. When your computer boots up, you need to to enter the BIOS. Change SATA Native Mode to Enabled, save changes and exit.

17. After you log into Windows, your computer will find the “new” hardware. Wait until you get the popup message to restart your computer, say Yes to restart one last time.


Credits: http://saysprasad.wordpress.com/2009/02/01/installing-sata-drivers-for-enabling-sata-native-mode-after-installing-windows-xp/

SQL Backup procedure using SQL Management Studio

Please follow the below mentioned steps for:

SQL Database Backup Procedures via SQL Management Studio

1. Start SQL Management Studio

2. Point to Management > Maintenance Plans

a. Right click “Maintenance Plans” and choose New Maintenance Plan

b. Give a name for a New Plan

3. In left panel, drag and drop the ‘Back Up Database Task” to right panel [Screen shot below]

1. Double click the new “Back Up Database Task”

a. Connection: Local server connection

b. Databases: **Please choose the correct database**

c. Backup Type: Full

d. Destination

i. Back up to: Disk

ii. Folder: Please choose the location for the backup file (different location of the production database)

iii. Okay to complete

2.

a. In a Job Schedule Properties

i. Give a name [Example Transaction Log Backup]

ii. Schedule type: Recurring

iii. Occurs: Daily

iv. Occurs once at: 00:00:00am (Time)

v. Okay to complete


Part B – Transaction Log Backup Procedures via SQL Management Studio


1. Start SQL Management Studio

2. Point to Management > Maintenance Plans

a. Right click “Maintenance Plans” and choose New Maintenance Plan

b. Give a name for a New Plan

3. In left panel, drag and drop the ‘Back Up Database Task” to right panel


[Screen shot below]


1. Double click the new “Back Up Database Task”

a. Connection: Local server connection

b. Databases: **Please choose the correct database**

c. Backup Type: Transaction Log

d. Destination

i. Back up to: Disk

ii. Folder: Please choose the location for the backup file (different location of the production database)

iii. Okay to complete

2.

a. Name: Transaction Log

b. Occurs: Daily

c. Recurs every: * days ( Enter schedule)

d. Occurs every: * hour(s) ( Enter schedule)

e. Starting at: 8:00am

f. Ending at: 11:59:59pm


Thats It !

Resolve VPN Error 809 in Windows Vista

You may get Error 809 if VPN connection is attempted from Windows Vista using Microsoft VPN Client . this occurs if your router is behind NAT device.

By default, Windows Vista and the Microsoft Windows Server Code Name “Longhorn” operating system do not support Internet Protocol security (IPsec) network address translation (NAT) Traversal (NAT-T) security associations to servers that are located behind a NAT device. Therefore, if the virtual private network (VPN) server is behind a NAT device, a Windows Vista-based VPN client computer or a Windows Server “Longhorn”-based VPN client computer cannot make a Layer Two Tunneling Protocol (L2TP)/IPsec connection to the VPN server.

This issue can be resolved if we make changes to registry.

Always backup Registry before its modified

Make sure Firewall is OFF and follow the below mentioned steps

1. Go to Start>Control panel> User accounts and Turn OFF User control

2. Go to start and enter cmd. this will open command

3. Enter “netsh advfirewall set global ipsec ipsecthroughnat serverandclientbehindnat” without quotes in command prompt.
This will add a new entry “IPsecThroughNAT” in the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy location


4. Open registry editor by entering cmd in Start> Run

5. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent

6. On the
Edit menu, point to New, and then click DWORD (32-bit) Value.

7. Type AssumeUDPEncapsulationContextOnSendRule, and then press ENTER

8. Right-click AssumeUDPEncapsulationContextOnSendRule, and then click Modify.

9. In the Value Data box, type one of the following values: 2

A value of 2 configures Windows so that it can establish security associations when both the server and the Windows Vista-based or Microsoft Windows Server Code Name “Longhorn”-based VPN client computer are behind NAT devices.

10. Restart your computer

Thats it !