Always looking for an easy life.

Windows system GUI is straightforward for administrators if you have some light duties occasionally and know what to do — a few clicks and it’s done.

However, sometimes you get tasks which needs to be repeated many times on different objects — either you still keep clicking until you feel tired or wonder if there is a better way to do it?

Yes, there is always alternative way to do aministration tasks — using PowerShell or tradionial Windows command lines.

Like today I needed to grant 10+ drives access to a user and share them out on a Windows 2016 server. Most of my time I work on *nix platform, my world is a command line one. I have the GUI instructions to do that, but after 2 drives were done, I already clicked a lot and doubt if I was going to continue. I started to google how to do that with commands:

  1. Grant the user “JoeServerUser” full access to a path (D drive in this example, all objects in the current directory and its subdirectories) with Object & Container inherit. It might cause the Recycle Bin corrupted and use “rd” to resovle it.
C:\Windows\system32>icacls D:\ /grant JoeServerUser:(OI)(CI)F /T
C:\Windows\system32>rd /s /q D:\$RECYCLE.BIN

2. Share P drive out and give the user “JoeServerUser” full access and everyone read access.

C:\Windows\system32>net share cache01=P:\ /grant:JoeServerUser,full /grant:Everyone,READ /unlimited

3. Test the share from another computer and map it to G drive locally using the user “JoeServerUser” with the password “tWe$123T!”

C:\Users\Administrator>net use G: \10.10.12.170\cache01 /user:JoeServerUser tWe$123T!
C:\Users\Administrator>net use
C:\Users\Administrator>net use G: /delete

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s