0 votes

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.

by (110 points)

1 Answer

0 votes
by (272k points)
selected by
Best answer

Hello,

Have a look at the following script from our repository: https://www.adaxes.com/script-repositor ... y-s528.htm. Finally, your Scheduled Task will look like the following:

0

Hello,

thank you very much, I appreciate that.
I will test it for the next users to go productive.

Sincerely RSHergh

Related questions

0 votes
1 answer

I have a Business Rule in place that after a new user is created, will create an Exchange mailbox for the user, set the Retention Policy for the user, then send them a ... the correct email address for the user. Is this maybe just a timing issue or something?

asked May 16, 2014 by RickWaukCo (320 points)
0 votes
1 answer

So this works for us however we would like to add to check if the last group is at 3 users we would like to send a seperate email but would still like all the above to continue to happen the way it is.

asked Mar 2, 2022 by Keonip (160 points)
0 votes
1 answer

We have a single AD domain that also matches our primary email domain (e.g. @primarydomain.com), but we also have multiple company specific email domains (e.g. @companydomain. ... like to also link the companydomain.com to the user's company value set in AD.

asked Apr 29, 2020 by JacquesKruger (20 points)
+3 votes
1 answer

three-quarters of the year is over, is there still a major update planned for this year? And if so, is there already an approximate release date?

asked Sep 2, 2022 by Domenic (50 points)
0 votes
1 answer

Hello, we're currently having issues to disabling user accounts on a specific date and time. When our HR department wants to start a "Offboarding", we're created a ... can we link it to the *After approval of disabling account field? Thanks in adavantage.

asked Aug 24, 2021 by BeliarsFire (20 points)
3,351 questions
3,052 answers
7,791 comments
545,079 users