Tuesday, February 26, 2013

Some Helpful Commands

Hi All,

Ever needed to get the Dell service tag in a hurry and didn't have server manager installed? Open a command prompt and run the below command:

wmic bios get serialnmber 


Get DELL Model and Serial number


wmic csproduct get name,identifyingnumber

------------------------------------------
How to Unlock An Active Directory account Using Command Line

If you require to unlock a user account without the use of active directory users and computers mmc snapin you may use the below command:

NET USER (Username E.G:John.Doe) /Domain /active:yes


--------------------------------------------

Adding BesAdmin Permissions to a exchange 2010 database;


Get-MailboxDatabase | Add-ADPermission -User "BESAdmin" -AccessRights ExtendedRight -ExtendedRights Receive-As, ms-Exch-Store-Admin

----------------------------------------------


To log sessions off of server you can run the following commands from a remote machine, Open CMD prompt as the relevant Domain and then enter the below cmd:

query session /server:servername

This will show all active sessions on the Server. To reset/logoff a session simply type the below command with the Session ID as shown in the previous query statement:
reset session 4 /server:servername

-------------------------------------------------------------

File Sharing Permissions via command line


If you require that all sub folder of a specific folder inherit their permissions from the parent there is a simple command that can be run from the command prompt.

Command Prompt:

D:\{usershare}\:> icacls [Directory] /inheritance:e /T

icacls – is the utility built into server 2003 SP2 and up, [followed by directory], /inheritance:e – enables inheritance and the /T switch is to set for all files and sub-folders.

Administrator ownership will be required.