creating Xtemp and Ytemp temporary folders with user permissions

Need assistance with a Powershell script for automatically creating Xtemp and Ytemp temporary folders
The folders to be created have the following path

\contoso.local\home\homeshare<username>\home\Xtemp\Xtemparchive
\contoso.local\home\homeshare<username>\home\Ytemp
The users should have write access within these folders

Looking to create a powershell script that takes the username as an input parameter, and executes the following file system operations
-Create the user-folder \contoso.local\home\homeshare<username>

-Disable inheritance at the level \contoso.local\home\homeshare<username> and convert all inherited file system permissions to explicit permissions

-Change owner to

-Give the following groups Full Control:

SYSTEM
Administrators
GroupA

GroupB

-Give the Read & Execute Permissions

-Remove all other permissions from the folder

-Create the folder called “home” within the folder

-Create the XTemp folders \contoso.local\home\homeshare<username>\home\Xtemp\Xtemparchive

-Create the Ytemp folders \contoso.local\home\homeshare<username>\home\Ytemp

Add Modify-permissions for at the level \contoso.local\home\homeshares<username>\Home\Xtemp\

-Add Modify-permissions for at the level \contoso.local\home\homeshare<username>\home\Ytemp

Mike,
Welcome to the forum. :wave:t4:

What kind of help do you need?

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

And BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink:

1 Like