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.


:)
2876 posts

Uber Geek
+1 received by user: 85

Subscriber

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
2505 posts

Uber Geek
+1 received by user: 932

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



:)
2876 posts

Uber Geek
+1 received by user: 85

Subscriber

  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.





18 posts

Geek
+1 received by user: 2


  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)



:)
2876 posts

Uber Geek
+1 received by user: 85

Subscriber

  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 »

Hawaiki Transpacific cable ready-for-service
Posted 20-Jul-2018 11:29


Microsoft Dynamics 365 Business Central launches
Posted 10-Jul-2018 10:40


Spark completes first milestone in voice platform upgrade
Posted 10-Jul-2018 09:36


Microsoft ices heated developers
Posted 6-Jul-2018 20:16


PB Technologies charged for its extended warranties and warned for bait advertising
Posted 3-Jul-2018 15:45


Almost 20,000 people claim credits from Spark
Posted 29-Jun-2018 10:40


Cove sells NZ's first insurance policy via chatbot
Posted 25-Jun-2018 10:04


N4L helping TAKA Trust bridge the digital divide for Lower Hutt students
Posted 18-Jun-2018 13:08


Winners Announced for 2018 CIO Awards
Posted 18-Jun-2018 13:03


Logitech Rally sets new standard for USB-connected video conference cameras
Posted 18-Jun-2018 09:27


Russell Stanners steps down as Vodafone NZ CEO
Posted 12-Jun-2018 09:13


Intergen recognised as 2018 Microsoft Country Partner of the Year for New Zealand
Posted 12-Jun-2018 08:00


Finalists Announced For Microsoft NZ Partner Awards
Posted 6-Jun-2018 15:12


Vocus Group and Vodafone announce joint venture to accelerate fibre innovation
Posted 5-Jun-2018 10:52


Kogan.com to launch Kogan Mobile in New Zealand
Posted 4-Jun-2018 14:34



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.