Jump to content

create a share based on computername and give permissions


Recommended Posts

Posted

Hi all I want to create a powershell script to run during my mdt task sequence that will

A. rename a local folder called 'test folder' and rename it to the local machine name

b share that newly renamed folder as is its computer name

c. give full permissions to a group called itadmins

 

this is what I have so far

 

Rename-Item "c:\test folder" $env:computername

Get-ChildItem Env:COMPUTERNAME | select -exp value

New-SMBShare –Name value –Path “C:\Env:COMPUTERNAME” `

–ContinuouslyAvailable `

–FullAccess domain\itadmin `

 

So part A works ok but part B and thus part C do not, I know that this Get-ChildItem Env:COMPUTERNAME | select -exp value returns the machine name so I need to know how to then use that later to create the share and set the permissions

 

complete powershell noob but giving it a go :) and as always any help gratefully received.

 

thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...