LeeAU Posted January 23, 2019 Posted January 23, 2019 (edited) I'm trying to give our Service Desk guys full control of our user profile and home directories by running a PowerShell script. This is the script I'm running: $Acl = (Get-Item "\\MYSERVER01\Profiles$").GetAccessControl('Access') $Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("MYDOMAIN\ServiceDesk", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow") $Acl.SetAccessRule($Ar) Set-Acl -path "\\MYSERVER01\Profiles$" -AclObject $Acl I am running it on a total of 90 servers. The problem is the script has now been running for two weeks and is only around half way through! Running the above command on one server individually takes hours and hours. There isn't a lot of data in the users profile and home directories either. I can't work out why it's taking so long for the script to run!? What am I doing wrong? Edited January 23, 2019 by LeeAU
HPlum78 Posted January 23, 2019 Posted January 23, 2019 What OS / ps version you using? I seem to remember that this could be painfully slow but would need to look at it again to be sure.
jb2201 Posted January 23, 2019 Posted January 23, 2019 Are you running it from one workstation and calling the commands on remote folders on each server? If so I would utilise powershell remoting so that the commands are running on the servers directly. 1
LeeAU Posted January 23, 2019 Author Posted January 23, 2019 What OS / ps version you using? I seem to remember that this could be painfully slow but would need to look at it again to be sure. Windows 10 Pro x64 and PowerShell 5.1.17134.407 Are you running it from one workstation and calling the commands on remote folders on each server? If so I would utilise powershell remoting so that the commands are running on the servers directly. Yes, from my workstation. How would one go about this? Is it just an extra line I need to input?
LeeAU Posted January 24, 2019 Author Posted January 24, 2019 Are you running it from one workstation and calling the commands on remote folders on each server? If so I would utilise powershell remoting so that the commands are running on the servers directly. Googled it and managed to get it working, it is much faster! thanks a lot. This will come in handy in future scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now