Link to home
Start Free TrialLog in
Avatar of bibi92
bibi92Flag for France

asked on

call icacls on powershell script failed with user variables

Hello,

I try to execute this powershell script :
$Domain="test"
$User="dba"
$UD = $Domain +"\"+ $User
Invoke-Item "icacls.exe c:\test\ /T /C /grant '%UD:(OI)(CI)F'

This message is returned :
$U: No mapping between account names and security IDs was done.

How can I resolve this problem?

Thanks

bibi
Avatar of Xaelian
Xaelian
Flag of Belgium image

can you try the following?

$Domain="test"
$User="dba"
$UD = $Domain +"\"+ $User
icacls.exe c:\test\ /T /C /grant '$UD:(OI)(CI)F'

You used %UD this won't work :).
Avatar of bibi92

ASKER

I have try your command :
$UD: No mapping between account names and security IDs was done.
Successfully processed 0 files; Failed processing 1 files

Thanks

bibi
ASKER CERTIFIED SOLUTION
Avatar of Xaelian
Xaelian
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bibi92

ASKER

thanks

bibi