Troubleshooting Apps – 6/15/2009
This morning we were supposed to have an IT tech appear as a guest speaker, but he unfortunately had a death in the family and wasn’t able to make it. In it’s place, we did a nice little command line utility tutorial and used our newly-begotten skills to make a batch file that could be deployed to Startup groups across many Windows platforms, simplifying greatly our administrative tasks. Here are some of the things we learned today
Mapping a Drive – Making a space for file storage on a server is a snap, provided you know the UNC of the server share and how to create that drive mapping in your particular version of Windows. Unfortunately, many of our end users won’t (and why should they, that’s our job!). So using the net command to accomplish that makes things easy:
net use J: \\server01\data
Creating Multiple Local Users
In some cases, it’s desirable to have all of your machines have a set of local user accounts already set up. Depending on how you look at things, this can be a boon to security — instead of having a stock local admin account, you can have several which can be audited to better determine who is doing what on a given machine. On the other hand, this could be seen as a greater risk as there are multiple accounts, and therefore multiple points of attack, that could be used to do administrative tasks. So, whichever way you fall, here’s how you would create individual administrator accounts (2 steps: 1 to create the accounts, 1 to add them to the administrators group):
First, let’s make the users…
net user BillyBob /add
net user JoeDan /add
net user HankRay /add
net user Chester /add
net user Habib /add
… and now, let’s add them to the administrators group.
net localgroup Administrators BillyBob /add
net localgroup Administrators JoeDan /add
net localgroup Administrators HankRay /add
net localgroup Administrators Chester /add
net localgroup Administrators Habib /add
Copying like a Jedi Master
Ok, maybe that’s a stretch, but if you’ve ever tried to use the copy command, you’ll know how limited it is. For one thing, it doesn’t take any subdirectories with it, and it also ignores ACLs. If you’re moving files from one NTFS volume to another, you know how damaging this can be — imagine losing all of those precious permissions you’ve spent so much time crafting and troubleshooting!
Here’s a command that will copy the contents of a given directory AND keep any ACL information (the command below will actually also keep auditing settings as well…)
xcopy D:\files\marketing\*.* F:\Files\ /s /e /x
(the /s switch takes subdirectories with the copy, not just the files in the target folder; the /e switch will create even empty folders; and the /x switch copies all ownership, ACL and auditing information. Put them together, and it’s pretty memorable, if you ask me. Ok, the /e switch implies the /s one, but /e /x just isn’t as fun…)
Of course, there are literally hundreds more tasks you can do with the command prompt (and saving these commands in a text file with a .bat extension makes things incredibly easy — just double-click and go!)
Homework:
- Nothing! Enjoy your break!