October 6, 2017 at 7:15 pm #81497ParticipantPoints: 0Rank: Member
I am scouring the internet trying to find the right scripting knowledge to create a powershell script. I'm close, but running into too many issues. I'm hoping a Powershell expert can shed some light. Here is what I'm trying to accomplish.
1. Run a script with an arguement of %samAccountName% (I'm using Zohno Z-hire to automate new user creation, etc)
Example>> test.ps1 %samAccountName%
2. The samAccountName will be fed from AD and used to name the new users home folder on fileserver1, for example. Full path on that server would be \\fileserver1\d$\home\%samAccountName%.
3. Once the folder is created, it needs to be shared as \\fileserver1\%samAccountName%. Domain admins should have full control of the share, and the new user should have change access. "Everyone" permissions should be removed. (I'm not 100% sure how necessary this is. In the past I've just given Everyone full control.)
4. For the folders security permissions, inheritance should be removed, domain admins should have full control, the new user should have modify. No other users or groups should have permissions on the folder.
5. The script should also check to be sure the folder name doesn't already exist.
Any help would be appreciated!! 🙂
October 7, 2017 at 11:23 am #81511ParticipantPoints: 207Rank: Participant
A few items here.
First all of this is doable.
However, this can take a little or a lot of work depending on what version of The Windows OS you are on and what version of PowerShell you are running or are allowed to upgrade to.
So, it would be prudent for you to provide that first, as that will determine what is the best approach. There are more newer cmdlets in the later version of the Windows OS to help here as it has the net SMB cmdlets.
•SMB Share: Get, New, Set, Remove
•SMB Share Access: Get, Grant, Revoke, Block, Unblock
•SMB Configuration: Get, Set for Server, Client
•SMB Session: Get, Close
•SMB Open File: Get, Close
•SMB Mapping: Get, New, Remove
•SMB Connection: Get
•SMB Network Interface: Get for Server, Client
•SMB Multichannel Connection: Get, Update
•SMB Multichannel Connection: New, Get, Remove
•SMB Witness Client: Get, Move
Otherwise, you are talking more code to do things the old ways.
You don't say if you will be running this remotely, or via a task scheduler.
October 16, 2017 at 2:06 pm #82202ParticipantPoints: 0Rank: Member
One question I have first. Which version of Windows and Powershell would be best for what I'm trying to accomplish? I assume that the newer the version, the more features/cmdlets I will have. I can run it from my Win 10 machine or from the file server in which the home directories should be created. The file server is running Powershell v4.0. To answer your question, I would be running the script remotely and not from a task scheduler.
The topic ‘Help with script to create folder share and set permissions’ is closed to new replies.