Hi All,

I dont see where to post on the new forum and dont have time to waste on finding out so I am posting my question here.

This is a line from a Kscript I am writing.
What am I doing wrong:

for /F "tokens=1 delims=" %G IN (C:\domainaccounts.txt) do IF NOT /I "%G"=="#vAgentConfiguration.workgroupDomainName#\Domain Admins" net localgroup administrators "%G" /delete

Accounts are not removed.

If I run this from command line replacing :
#vAgentConfiguration.workgroupDomainName#\Domain Admins
%userdomain%\Domain Admins
it runs fine.

Now I thought my issue was kVariable, but when I email this to myself with the parentheses it comes through fine.
eg, MYDOMAIN\Domain Admins

I have attempted to run a set variable step prior to this which turns:
#vAgentConfiguration.workgroupDomainName#\Domain Admins

This also successfully emails, but wont execute in my command?

Any input greatly appreciated.

NOTE! Resolved. Was trying to be too tricky. I removed all users and re-added domain admin. Much easier. I also did not realise that users could not reply. Sorry about that.


Legacy Forum Name: Whats wrong with this line of script?,
Legacy Posted By Username: Obie