I am trying to create a date string for an LDAP query compatible with the Active Directory whenChanged . I pull AD data into CSV using CSVDE and you need an LDAP query that will filter the results for those items that have changed over the last 2 days. I put together the following FOR command to generate the first part of the comparison string based on several examples found here in Stack Overflow:
FOR /F "usebackq" %i in (`PowerShell $date^= [DateTime]::Today.AddDays^(-2^)^; $date.ToString^('yyyyMMdd'^)`) DO SET daysAgo = %i
This FOR command works fine from the command line, but the bombs inside the script package, with the output:
:Today.AddDays(-2); was unexpected at this time.
What makes a team bomb? Thanks.
source share