Friday, March 30, 2018

PoweShell TTUC (Tips, Tricks and Useful Commands) #114 – Move Files and Folders

PowerShell TTUC (Tips, Tricks and Useful Commands) - #114

Create a folder and assign appreciate permission using PowerShell

$OutputLocation = "C:\Temp\Folder1"
$adminUser = "Domain\Admin1"

#
if (-not(test-path $OutputLocaiton))  #verify the existance of "C:\Temp\Folder1" fodler
{
    #if not create a new folder
    New-Item -ItemType directory -Path $OutputLocaiton | out-null
    $cACL = Get-Acl $OutputLocaiton
    $nACL = New-Object  system.security.accesscontrol.filesystemaccessrule($adminUser,"Fullcontrol","Allow")
    $cACL.SetAccessRule($nACL)
    Set-Acl $OutputLocaiton $cACL

}




2 comments:

Thank you for sharing this tutorial with us! You are doing a great thing!

I ordered a replica gucci bag here. When I received the bag, it surprised me a lot.replica gucci handbags This bag is perfect and the quality is exactly the same.fake high quality gucci womens totes A dazzling masonry. I introduced this website to my friends, and my friends liked it very much.

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More