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.




2802 posts

Uber Geek
+1 received by user: 67


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

Uber Geek
+1 received by user: 907

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



2802 posts

Uber Geek
+1 received by user: 67


  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)



2802 posts

Uber Geek
+1 received by user: 67


  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 »

Public Wi-Fi plus cloud file sharing
Posted 18-Aug-2017 11:20


D-Link NZ launches professional Wireless AC Wave 2 Access Point for businesses
Posted 17-Aug-2017 19:25


Garmin introduces the Rino 700 five-watt two-way handheld radio
Posted 17-Aug-2017 19:04


Garmin announces the Foretrex 601 and Foretrex 701 Ballistic Edition for outdoor and tactical use
Posted 17-Aug-2017 19:02


Brightstar announces new distribution partnership with Samsung Knox platform in Australia
Posted 17-Aug-2017 17:07


Free gig-enabled WiFi network extends across Dunedin
Posted 17-Aug-2017 17:04


Samsung expands with connect Gear S3 Frontier
Posted 17-Aug-2017 15:55


Fact-checking Southern Cross Next cable is fastest to USA
Posted 17-Aug-2017 13:57


Thurrott says Microsoft Surface is dead last for reliability
Posted 16-Aug-2017 15:19


LibreOffice 5.4 works better with Microsoft Office files
Posted 16-Aug-2017 13:32


Certus launches Cognition
Posted 14-Aug-2017 09:31


Spark adds Cambridge, Turangi to 4.5G network
Posted 10-Aug-2017 17:55


REANNZ network to receive ongoing Government funding through to 2024
Posted 10-Aug-2017 16:05


Chorus backhaul starts with 2degrees
Posted 10-Aug-2017 15:49


New Zealanders cool on data analytics catching benefit fraud
Posted 10-Aug-2017 09:56



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.