Hey everyone,
I hope you guys can help me out here.
Our HR management is creating new users regulary and fill in the "Starting Date" date and time.
There are different entry's in the Starting date-Time since we have multiple key-users who insert different times. (i.e. 08:00; 08:30; 09:00;...)
Now when im creating an scheduled task (once a day at 08:00) and add the argument below im not sure that it will equal $True since the times will differ from the times written in the StartDate
if {Get-Date -eq StartDate} {
#send email
}
Thats why I'd like to remove the time from %adm-CustomAttributeDate2%" with a split and divide the property value into two variables and replace the old date&time-value with the new date-value. So i will always have in the StartingDate property value for the time 00:00.
Below my small script.
Import-Module Adaxes
$startdate = "%adm-CustomAttributeDate2%"
$spDate,$spTime = $startdate -split ' '
set-admuser -identity %sAMAccountName% -replace @{adm-CustomAttributeDate2="$spDate"}
PS.: Just recently I started to work with powershell
When I try to run the custom command on a User i get
In Zeile:7 Zeichen:45 + set-admuser -identity sbandit -replace @{adm-CustomAttributeDate2="$s ... + ~ Missing '=' operator after key in hash literal.
In Zeile:2 Zeichen:5 + try { + ~the closing "}" is missing or the typdefinition.