Man you're awesome. The last few days I was working to make this and all the pages, forums, blogs... didn't solve my problem. Thanks for make this video and explain soo well how to use this method, finally the icacls method worked super
I prefer the icacls method over the powershell module too. I had instances with ancient servers where powershell module was not an option so ICACLs was the clutch factor. Anyways, glad it helped!
Beginner user on Powershell and simply trying to delete a file with a long name. Command prompt on DOS won't work for this, so I tried Powershell. When I log into Powershell as administrator and use the "del" command with the file path for the full file name (obtained from the "dir" command), it says the file can't be found. I was able to copy the actual file path, which displayed as an abbreviated name, and when I tried deleting that, the message is that I don't have permission to perform this function. I've watched your video but it's a bit complex for me at this point. Could you go over the simplest way for me to change the permissions in Powershell, just for that file, so I can delete it? If there's a way for me to send you the screen captures of what I'm describing, please let me know. I appreciate your help and thanks.
sorry Im 2 months too late. but I think you can try using "GCI -path {your path}" or "GCI -path {your path} -filter *{your filename}" Those should find your file and show the full path so you can use it to delete
Hi. i want to get full access of this file "C:\Windows\System32\en-US otepad.exe.mui" but it doesnt work with the methods shown on the video. Can you help me? (please)
how to use $folderPath = "F:\TEST Folder" $user = "Test1ng" $grant = "/grant:r" $permission = ":(OI)(CI)(M)" $inheritance = "/inheritance:e" Invoke-Expression -Command ('icacls $folderPath $inheritance $grant "${user}${permission}"') for multiple folders in a location do i add a commer after "F:\TEST Folder","F:\TEST Folder 2" or there is another way?
What is the command to apply it to the folder, subfolders and files? This is my first time doing PowerShell Script and you explained it really good. Now I have something to present to my IT Manager. Will you be able to help me with applying the full control to folder, subfolders, and files? Thanks in advance!
Depending on the method you chose, its gonna change. I personally like to use icacls so in that case use this to figure out what you need ss64.com/nt/icacls.html
Is there a way to do this using the first method without adding a whole new access group? I simply want to modify the existing "Users" group but instead it adds a secondary Users group. Thanks for your video!
@@CodeDogeI'm trying to change folder and registry folder permissions on client machines, eventually I'll want to push out this script to all company machines. Do you think this is the best way to achieve that? Or should I be using a batch file? Thanks again for your help.
@@lespatriotes4101 taking a wild guess, but your error message looks like the cred executing script doesnt have access rights to set access rights. Also I did this is ps 5.1
Great video - how do you add container inheritance and object inheritance using the powershell version? thanks also (Get-Acl -Path $FolderPath).Access | ft and Invoke-Expression -Command ('icacls $Folderpath') are useful to see the changes
@@Harry-tc1im yeap I had the same issue once, was a using a onprem server that had powershell 3.x and we could not update it for whatever reason. Had to use the icacls method. Also had an issue where we were trying to create/push files to a shared drive and due to access issues, icacls.exe was the way to go again. Thanks again for watching and Im so happy I was able to help!
I think BUILTIN is the default user, you should be able to pass any valid user thats on your active directory. I was able to do this both at work and on my home local pc. Lmk if you get stuck Ill try to help debug!
Great video, but 3 times! 3 times you want to show us the security properties of the "testFolder", but you show us the security properties of the "YT Video Folder" by right clicking without having the focus on the folder. 0:17 3:13 5:36
lol sorry about that. I made a mistake with the audio the first time when I was recording and I deleted the contents after the first session. I had to redo parts of the video and when I was working on the video it was like 2 am because of that. I take a lot of takes because I dont want to include my "uhs" and time wasting portions, so I record in small chunks. It was a huge ordeal to splice take 1 and take 2, I probably lost track of this during that editing. Anyways, I hope it was still helpful regardless!
Yes, that should be fine. It should be okay to use a ServiceAccount or UserGroup in the $user variable. I have done it in the past with no issue so do let me know if theres a problem so I can try and help you out
you can definitely restrict access to folders by user/user group with powershell. As far as doing it in Non admin mode, I think it is unlikely. It may be possible if you have your user that you are auth as a part of user groups that can make the change, but I think its far easier to run in admin
wrap the base logic to add to a folder path and iterate through a loop, so something like, foreach ($folder in $foldersList) { } and inside {} is the logic
you can use move-item or other tactics such as replace/rename files/locations. Video below might give an idea on the latter ruclips.net/video/tiouHNzAl8Q/видео.html
thank you so much i literaaly watched the first 21 seconds and got the help i needed! New Sub
so glad it was helpful so fast!
This is SUPER helpful! #1 fan... for all your videos.......
You're the best!
not a programmer but I followed it and to my surprise works
Im so happy to hear this! glad it helped!
Man you're awesome. The last few days I was working to make this and all the pages, forums, blogs... didn't solve my problem. Thanks for make this video and explain soo well how to use this method, finally the icacls method worked super
I prefer the icacls method over the powershell module too. I had instances with ancient servers where powershell module was not an option so ICACLs was the clutch factor. Anyways, glad it helped!
omg u really need a raise buddy. love your work ,keep it up
haha I'd like to introduce you to my boss and if you could just repeat that same sentence, thatd be great!
Glad you found it helpful!
@@CodeDoge lmao
Thank you very much, in cmd the iCACLS just doesn't work, but when i used your method, it worked
glad it was helpful! Lmk if you have any future topics you want me to cover
@@CodeDoge for shure!
Beginner user on Powershell and simply trying to delete a file with a long name. Command prompt on DOS won't work for this, so I tried Powershell. When I log into Powershell as administrator and use the "del" command with the file path for the full file name (obtained from the "dir" command), it says the file can't be found. I was able to copy the actual file path, which displayed as an abbreviated name, and when I tried deleting that, the message is that I don't have permission to perform this function. I've watched your video but it's a bit complex for me at this point. Could you go over the simplest way for me to change the permissions in Powershell, just for that file, so I can delete it? If there's a way for me to send you the screen captures of what I'm describing, please let me know. I appreciate your help and thanks.
sorry Im 2 months too late. but I think you can try using "GCI -path {your path}" or "GCI -path {your path} -filter *{your filename}"
Those should find your file and show the full path so you can use it to delete
Hi. i want to get full access of this file "C:\Windows\System32\en-US
otepad.exe.mui" but it doesnt work with the methods shown on the video. Can you help me? (please)
looks like thats a specific file. I would give access to the parent directory of that file and it should allow access to the file itself
how to use
$folderPath = "F:\TEST Folder"
$user = "Test1ng"
$grant = "/grant:r"
$permission = ":(OI)(CI)(M)"
$inheritance = "/inheritance:e"
Invoke-Expression -Command ('icacls $folderPath $inheritance $grant "${user}${permission}"')
for multiple folders in a location
do i add a commer after "F:\TEST Folder","F:\TEST Folder 2"
or there is another way?
if you got multiple folder paths you should put the base code inside a loop and execute it against the list of folder paths
What is the command to apply it to the folder, subfolders and files? This is my first time doing PowerShell Script and you explained it really good. Now I have something to present to my IT Manager. Will you be able to help me with applying the full control to folder, subfolders, and files? Thanks in advance!
Depending on the method you chose, its gonna change. I personally like to use icacls so in that case use this to figure out what you need ss64.com/nt/icacls.html
Same question here...
@arlenewillems8041 For future generations. Add /T /C at the end.
Invoke-Expression -Command ('icacls $folderPath $inheritance $grant "${user}${permission}" /T /C')
Is there a way to do this using the first method without adding a whole new access group? I simply want to modify the existing "Users" group but instead it adds a secondary Users group.
Thanks for your video!
its been some time since making this video and using this script, but you should be able to use a user directly. doesnt have to be a AD group
@@CodeDogeI'm trying to change folder and registry folder permissions on client machines, eventually I'll want to push out this script to all company machines. Do you think this is the best way to achieve that? Or should I be using a batch file?
Thanks again for your help.
tyty
ywyw
Actually i am not understanding completely, need your help creating the scripts, please help me
hey, what part exactly? its really tough to help without any breadcrumbs on how I can help
Hello, both solutions doesn't work...why don't you type before in powershell $PSVersiontable for both solution i get an error message....
Set-Acl : Tentative d'exécution d'une opération non autorisée.
Au caractère Ligne:9 : 8
+ $acl | Set-Acl $folderPath
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (D:\Soft_master:String) [Set-Acl], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetAclCommand
icacls : d:\Soft_master: AccŠs refus‚.
Au caractère Ligne:1 : 1
+ icacls $folderPath $inheritance $grant "${user}${permission}"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (d:\Soft_master: AccŠs refus‚.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
@@lespatriotes4101 taking a wild guess, but your error message looks like the cred executing script doesnt have access rights to set access rights.
Also I did this is ps 5.1
Great video - how do you add container inheritance and object inheritance using the powershell version? thanks
also
(Get-Acl -Path $FolderPath).Access | ft
and
Invoke-Expression -Command ('icacls $Folderpath')
are useful to see the changes
not sure what you mean for container/object inheritance in regards to this videos context.
@@CodeDoge the equivalent of (CO)(IO) parameters used in the icacls command
Super helpful and thanks for the second option. When I run the code it it adds BUILTIN (BUILTIN) instead of the user, any recommendations?
I was using the second option as my powershell seems to be out dated
@@Harry-tc1im yeap I had the same issue once, was a using a onprem server that had powershell 3.x and we could not update it for whatever reason. Had to use the icacls method. Also had an issue where we were trying to create/push files to a shared drive and due to access issues, icacls.exe was the way to go again. Thanks again for watching and Im so happy I was able to help!
I think BUILTIN is the default user, you should be able to pass any valid user thats on your active directory. I was able to do this both at work and on my home local pc. Lmk if you get stuck Ill try to help debug!
Great video, but 3 times! 3 times you want to show us the security properties of the "testFolder", but you show us the security properties of the "YT Video Folder" by right clicking without having the focus on the folder.
0:17
3:13
5:36
lol sorry about that. I made a mistake with the audio the first time when I was recording and I deleted the contents after the first session. I had to redo parts of the video and when I was working on the video it was like 2 am because of that. I take a lot of takes because I dont want to include my "uhs" and time wasting portions, so I record in small chunks. It was a huge ordeal to splice take 1 and take 2, I probably lost track of this during that editing. Anyways, I hope it was still helpful regardless!
If I wanna add a group of 3 users, and the group's name was Hello. So I should write $user = "Hello". Is it correct or ... ?
Yes, that should be fine. It should be okay to use a ServiceAccount or UserGroup in the $user variable. I have done it in the past with no issue so do let me know if theres a problem so I can try and help you out
Good video is it possible to restrict access to folders with command prompt and not in admin mode ?
you can definitely restrict access to folders by user/user group with powershell. As far as doing it in Non admin mode, I think it is unlikely. It may be possible if you have your user that you are auth as a part of user groups that can make the change, but I think its far easier to run in admin
How to add multiple folderpath?
wrap the base logic to add to a folder path and iterate through a loop, so something like, foreach ($folder in $foldersList) { } and inside {} is the logic
How do I change the location?
you can use move-item or other tactics such as replace/rename files/locations.
Video below might give an idea on the latter
ruclips.net/video/tiouHNzAl8Q/видео.html