Here are the most useful shortcuts and tricks I use of a daily basis for desktop administration. Tricks that freed up enough time to allow me to write this. Just like you should know three jokes you can tell at the drop of a hat, here are six simple command lines (and some variations) that can save you tons of time and hassle. It does not take much to commit them to memory them, but what a difference they will make… and the command lines are useful too.
- Everything starts with runas. Learn it, love it, live it. This command allows you to work in an admin profile on any computer you sit down in front of, become a gypsy with no system of your own, and never ask a user to log off to accomplish something. Runas is just plain powerful computer Kung Fu.Runas /user:%domain%\%username% %command%
Runas /user:mydomain\myaccount cmd
My preference is to always first open a command window as the runas user of my choice, then execute any elevated commands there. You can run the command you want to execute with alternate credentials directly from start>run, but I find that doing so is more prone to error and ends up taking longer. Also, if you are attempting to run the command as the local administrator you can omit the [domain\] option on XP and above [runas /user:administrator cmd].
Once you have the command window open, you are free to do anything you want. The examples below are those I most often execute from a runas command window.
- Uninstall an application (open add/remove programs):
appwiz.cpl in the command window.
If a user is logged in (without admin rights) you can remove and re-install the software without needing them to log off first. You can execute any control panel applet from the runas command window. Search for *.cpl and to find a list all the different applets you can run. You can guess what most do.
- Manage local users and groups on a remote machine:
Lusrmgr.msc –a /computer=%computername%
Lusrmgr.msc –a/ computer=deepthought
Get creative with these. What’s that you ask? Your domain account does not have admin rights on the remote machine? Synchronize your local admin password with the local admin password on the remote machine. Then open a runas window on your system as the local admin and run the local users and groups console (lusrmgr.msc) targeted to the remote machine and give your domain account access.
- Create a shared folder on a remote machine… or any other computer management function:
Compmgmt.msc –a /computer=%computername%
Lusrmgr.msc –a /computer=eniac
You’ll find you can target most mmc consoles against a remote host with the [–a /computer]= option. If you are just managing user accounts, use the specific console, it is faster. Not sure the name of the console you are looking for? Search for *.msc.
- Start a web browser session to install something from the Internet or your internal site?
Start>run iexplore will start Internet Explorer for the logged in user, but from a command window iexplore does not work…. But “start iexplore” does. Cool.
- Start a terminal services session on a remote machine
Mstsc /v %computername%
Mstsc /v bigblue
If you use the remote desktop connection extensively, open the console (mstsc) set the options you want, then save the settings for your connection(s) as an *.rdp file in a folder. Lastly, add that folder as a toolbar. If you are using Vista it will allow you to save the username and password and you end up with a one-click shortcut menu to connect to remote machines.
- Test a package or software install as if it were running from SMS.
AT %TIME% /INTERACTIVE %CMD%
AT 14:30 /INTERACTIVE CMD
The example above creates a scheduled task at 2:30PM to open the command window interactively with the logged in user. That command window will open and be running as the system account. Any command executed in that window will run as the system account – the same context SMS packages will run in. You want your command window now? Set to time to be 1 minute later that the current time… it’s the best you can do. Want to give someone admin rights, right now, on a remote computer without them needing to log off?
AT \\%COMPUTERNAME% %TIME% /INTERACTIVE %CMD%
AT \\HAL9000 14:30 /INTERACTIVE CMD
Yep, at 2:30 a command window will open on HAL9000 and any command executed inside that window will run in the system context. Well, that admin window doesn’t have any network access, but it is possible.
Sure there are other tips and tricks… but these are what I have found save me the most time. Hopefully they can save you time as well.