SOLVED
Found this article on serverfault
“Powershell has some high weirdness when mixing external commands and quoting.”
PS C:>icacls "C:/foo
” /grant:r "Users
“:(F
)
Above worked.
I’m working on an offboarding script. I want to delegate a users home directory to their manager to have full permissions.
icacls “FileShareusers_Term$($TermEmp.SamAccountName)” /grant $EmpMgr.Name:F /T
ERROR
icacls : Invalid parmeter “domainmgr.Name”
I get an error “Invalid parameter” I know I must be overlooking something small and stupid, but just can’t figure it out. I’ve tried the managers Name, UPN, SamAccountName, I’ve tried “domain$($TermEmp.SamAccountName)” and I just keep getting the same issue. Is this just not an acceptable for the icacls command or am I missing something?
EDIT:
Double checked permissions; They’re good.
Tried $($empmgr.name); Same error, shows the managers name
Figured I’d try to call the SID so tried $EmpMgr.SID; Same error, shows the managers SID
submitted by /u/BitteringAgent
[link] [comments]
The post Not Totally Powershell, But a Quick Question appeared first on How to Code .NET.