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$adminUser,"Fullcontrol","Allow")
    Set-Acl $OutputLocaiton $cACL



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

Post a Comment

Popular Posts


Twitter Delicious Facebook Digg Stumbleupon Favorites More