?
Solved

call icacls on powershell script failed with user variables

Posted on 2012-08-13
4
Medium Priority
?
1,574 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:bibi92
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Xaelian
ID: 38288976
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 :).
0
 

Author Comment

by:bibi92
ID: 38289106
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
0
 
LVL 13

Accepted Solution

by:
Xaelian earned 2000 total points
ID: 38289204
Hi try this:

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

Author Closing Comment

by:bibi92
ID: 38289213
thanks

bibi
0

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question