Desktop application validity - time

I am creating a desktop application using AIR. In that application user is allowed to download some resources which have life span of 2 days. I am storing the date when the user is downloaded.
But how can i check whether the date is passed 2 days or not? Right now I am checking with the current system date.But when the user changes the system date to back, it will start to work which i dont want.
How the desktop applications say like flex builder and all having trial period.? How are they tracking the dates remaining?
~Umesh

In our application we store a license file on the client machine which stores the date the product was installed and has a counter (so only days the user actually opens the application causes a decrement). We also expire the license if the system date is tampered i.e. if the date < date the product was installed set the counter to the max days allowed. (to punish cheats :))
You could implement a similar solution or even just ignore the license and store the settings in the registry.

Related

System Time becomes incorrect on reboot of VMs

Ever since virtualizing several physical servers into GCP, I have had an issue where anytime the servers(s) are rebooted the time is changed to be several hours ahead (I think it's 4 hours, but may be 6 hours). My local office is located in CST time zone and that is what we want the server to display. In GCP the virtual servers are in the us-central1a zone. On the virtual server, run the tzutil /g command it shows that the server is set to "central standard time". It also shows Central timezone if I click the clock on the toolbar then choosing "change date and time settings"
After the server has been rebooted (and reports wrong time) I can correct the time by clicking the "update now" options (found on toolbar clock, "change date and time settings", internet time tab, change settings" "update now" (this points to time server time.nist.gov).
This issue only began occurring after migrating into GCP so I believe it to be a Compute Engine issue and not an OS issue.
any thoughts on why this might be happening? I have this on occurring on all 4 windows servers that were migrated into Google Cloud. three are win2008r2, and one is Win2012r2
I appreciate any help that can be given to get this resolved, as I can't even reboot without connecting to the server afterwards and checking/fixing the time, I do have set a startup script to delay and then sync time after rebooting, but it has not worked 100% of the time, so this is more of a band-aid than a fix.
I do have set a startup script to delay and then sync time after rebooting, but it has not worked 100% of the time, so this is more of a band-aid
Getting this script working is probably the solution, here. For what it's worth, you'd need to do the same thing on both Azure and AWS as well, since they also set Windows timezones to UTC by default using the same mechanism.
See AWS docs on the Specialize Phase
See this Stackoverflow question for a similar question about Windows on Azure
Normally all servers run on UTC time, its clients (applications, browsers, etc) set their timezones according to where they are, and its up to them to translate UTC time to whichever locale they are in. (Put another way, you wouldn't want a server with a million client connections to have to keep track of each client's timezone in order to work properly). In your case, the bottom line is that requiring a custom timezone on the server will also require a custom server configuration, and the behavior you're seeing is by design. That's why your best bet is to understand why the startup script isn't working like you expect it to.
For reference, these docs may be helpful:
Google Compute Engine: Providing a startup script for Windows instances
Google Compute Engine: Creating a Windows Image
If you looked at the VM instance logs in the GCP Console you'd see that VM BIOS reports time in UTC
2019/10/3 14:9:44 Begin firmware boot time
After a while BIOS hands over to the bootloader
2019/10/3 14:9:45 End firmware boot time
Booting from Hard Disk 0...
The OS boots up. Behind the scene the OS time service recognizes the system timezone, then sets up and synchronizes time with the time source. From that time forward running programs and services report events based on the local system time:
...
2019/10/03 09:10:05 GCEWindowsAgent: GCE Agent Started (version 4.6.0#1)
In the Windows Event Log you should see entries made by the Time-Service:
Log Name: System
Source: Time-Service
Level: Information
The time provider NtpClient is currently receiving valid time data from metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).
The time service is now synchronizing the system time with the time source metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).
In the command prompt you can ensure that the time configuration and state are correct:
C:\Users\user>systeminfo | find /i "Time"
System Boot Time: 10/3/2019, 9:09:49 AM
Time Zone: (UTC-06:00) Central Time (US & Canada)
Hence you don't need synchronizing time neither manually or with with a startup script. The time service will do it for you: to synchronize the system time right after the boot and to keep it in sync afterwards.
All you need is to set correct Time zone and the Internet time server for Windows, and then make sure the time server is reachable via the network.

Outlook 365 Cached Mode - Need Clarification

I have a query regarding outlook 365 cached mode. Say for example a new user has a outlook mails on server for three months say JAN, FEB and MAR. Let's say we are in 1st of April, iam configuring outlook365 cached mode to 1 month. So March mails will be available offline. Let's say one month is passed, now we are in MAY. Now what happens to MAR month mail which is already downloaded offline, since cache is set to one month. Will MARCH and APRIL mails will be available offline, or only APRIL mails will be available and march gets removed locally?
By default, if Cached Exchange Mode is enabled, Outlook caches email messages only from the last N months (in your case - 1-month-old) and removes anything older from the local cache for the PC. These default settings depend on the device, with mobile devices having smaller default settings. The email messages that are removed from the local cache are still available for users to view, but they’ll need to be connected to Exchange Server to view them. Users can view messages that were removed from the local cache by scrolling to the end of a message list in a folder and clicking the message Click here to view more on Microsoft Exchange. Users can also change how much email to keep offline. The administrator can change the default age or enforce the age of email messages that are removed from the local cache.

Expired date not working when date changed

I tried to create a program with an expired date, but if the date on the computer is changed, the expired date does not work anymore. how to solve it ?I made it using delphi
Need some more information to answer this effectively but it sounds like the issue occurs because the system is using the device's date/time/clock to determine the validity of dates.
The only way around this would be to hook into a webservice for an accurate date value that is then difficult to manipulate by changing the system clock.
There is another stackoverflow thread that addresses using internet time for these sorts of purposes:
Get internet time in delphi
I hope this helps!

Test and Enable CRM Mailbox programmatically

Is there a way to "Test and Enable" CRM Mailbox programmatically either using Powershell or CRM SDK? This is for initial user setup.
I have tried using Microsoft.Xrm.Data.Powershell, it does have Approve-CrmEmailAddress and Set-CrmUserMailbox but there doesn't seem to be a way to Enable Mailbox.
Afr thanks for trying out the Xrm Data Powershell module - I noticed that we haven't added that functionality yet so I'll work to get it checked in for the 2.6 release. As long as your mailbox has something to be enabled for (Incoming/Outgoing/ACT) then you can set the testemailconfigurationscheduled to true and check the result after it runs the test/enable process in the background. There also is a way to postpone/schedule it, but most folks want it run right away when they execute the request. You can also set the orgmarkedasprimaryforexchangesync, this tells the enable process to stamp the users mailbox so any other CRM environments know they no longer can sync with the users mailbox (only one org can sync to a mailbox at any one time).
HTH!
Sean
Afr - have you made any progress or found anything out with this? I am currently looking into the same thing. For some reason the mailboxes for a client of mine are being deactivated and upon reactivate I need to test & enable. But since the mailboxes that are deactivated are random - doing something dynamic in c# is a much better way to go.

How to clear the cache which is used by AuthzGetInformationFromContext API?

I have a domain and I use AuthzGetInformationFromContext API on the client machine to retrieve sid of the groups to which a user belongs.
It works fine. However, if I add the user to some group or remove him from some group on domain controller, this API will still show old list of groups. In the case, if i will wait 10 minutes or more, it will show updated list of groups.
I tried to do this on different computers and saw that the application will show updated list of groups at a different time. So, it's not a domain controller cache.
Also, my applications exits and starts again. So, it's not application level cache either.
So, I believe there is some computer level cache for group membership (retrieved through this API).
Does anybody know how to clear this cache programmatically or change some settings to decrease this 10 minutes interval to something shorter.
Accordig to this post and Kerberos Authentication problems – Service Principal Name (SPN) issues - Part 1, You can purge the Kerberos TGT (and all your service tickets) using something like klist purge (The tool is present on Windows Seven). You have to run the tool locally on the machine the user is logged in to.
You can find the source of Klist.exe in the Windows Platform SDK (the API in us is LsaCallAuthenticationPackage)
C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\security\authorization\klist

Resources