Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




2848 posts

Uber Geek
+1 received by user: 79


Topic # 143804 28-Apr-2014 07:50
Send private message

I'm busy building a Powershell script that will report on accounts that are soon to expire, where it collects the usernames and emails the managers.

All of the script is built, however I'm having a couple of issues where the dates are being converted to different values to what I'm expecting.

My understanding is that it gets converted from UTC/FileTime to local time, however, we are spread across NZ and AU, so a few different time zones. Therefore the time that my colleague in Sydney puts in, is 2 hours different to the one I entered, despite being the same value in AD.

Therefore, 28th February actually shows as the 1st March when pulled using powershell and converted.


Aside from using a query which will filter results such as "if 2 hours a head of time, move it back 2 hours", is there any way to fix/work around the issue?





Create new topic
2499 posts

Uber Geek
+1 received by user: 927

Subscriber

  Reply # 1032337 28-Apr-2014 08:35
Send private message

Well, the accountExpires property in AD is a numeric value giving the number of 100-nanosecond intervals after Jan 1st, 1601 UTC, that the account expires. So what method are you using to convert this back to a human-readable datestamp? This would be the step in which you convert it to the correct timezone.




Windows 7 x64 // i5-3570K // 16GB DDR3-1600 // GTX660Ti 2GB // Samsung 830 120GB SSD // OCZ Agility4 120GB SSD // Samsung U28D590D @ 3840x2160 & Asus PB278Q @ 2560x1440
Samsung Galaxy S5 SM-G900I w/Spark



2848 posts

Uber Geek
+1 received by user: 79


  Reply # 1032350 28-Apr-2014 08:56
Send private message

That is a good question - I'm using Quest cmdlets and it looks like that does the converting itself. I tried using the -dontconverttofriendlyrepresentation flag, but it didn't seem to dump the raw data.





 
 
 
 


17 posts

Geek
+1 received by user: 1


  Reply # 1037138 5-May-2014 16:36
Send private message

you could grab accounts expiring over a particular day period which would simplify time zone issues

this would get you all the accounts that are expiring tomorrow
Get-QADUser -AccountExpiresafter (get-date).AddDays(1) -AccountExpiresBefore (get-date).AddDays(2)



2848 posts

Uber Geek
+1 received by user: 79


  Reply # 1052834 25-May-2014 15:02
Send private message

stefankrz: you could grab accounts expiring over a particular day period which would simplify time zone issues

this would get you all the accounts that are expiring tomorrow
Get-QADUser -AccountExpiresafter (get-date).AddDays(1) -AccountExpiresBefore (get-date).AddDays(2)



Thanks for the reply... unfortunately that's not going to work in the way I'm applying it.

Basically, I'm running a report for Managers, which will email them the details of their employees, i.e. the contract end date we have listed. Because of the time issue when my colleagues extend the accounts from Australia, the time gets messed up by a couple of hours, which in turn reports as the following day, which then results in the Manager logging a call saying "please change" despite the fact it's actually already set correctly.

hopefully that makes sense..? 

Might just have to work around it by doing some If $date.time -eq 2am, then correct back one day and format to strong dd-mm-yyyy.

I only have to cater for two time zones, Perth and NSW, so might just bite the bullet and see if it works.





Create new topic



Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

$3.74 million for new electric vehicles in New Zealand
Posted 17-Jan-2018 11:27


Nova 2i: Value, not excitement from Huawei
Posted 17-Jan-2018 09:02


Less news in Facebook News Feed revamp
Posted 15-Jan-2018 13:15


Australian Government contract awarded to Datacom Connect
Posted 11-Jan-2018 08:37


Why New Zealand needs a chief technology officer
Posted 6-Jan-2018 13:59


Amazon release Silk Browser and Firefox for Fire TV
Posted 21-Dec-2017 13:42


New Chief Technology Officer role created
Posted 19-Dec-2017 22:18


All I want for Christmas is a new EV
Posted 19-Dec-2017 19:54


How clever is this: AI will create 2.3 million jobs by 2020
Posted 19-Dec-2017 19:52


NOW to deploy SD-WAN to regional councils
Posted 19-Dec-2017 19:46


Mobile market competition issues ComCom should watch
Posted 18-Dec-2017 10:52


New Zealand government to create digital advisory group
Posted 16-Dec-2017 08:47


Australia datum changes means whole country moving 1.8 metres north-east
Posted 16-Dec-2017 08:39


UAV Traffic Management Trial launching today in New Zealand
Posted 12-Dec-2017 16:06


UFB connections pass 460,000
Posted 11-Dec-2017 11:26



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.