.net - Detecting the time when the program was installed -
this question has answer here:
- get install date managed code 5 answers
can somehow detect time when program installed using .net or win32 api or other way?
this date of installation, i'm not sure of can time
string registry_key = @"software\microsoft\windows\currentversion\uninstall"; using(microsoft.win32.registrykey key = registry.localmachine.opensubkey(registry_key)) { foreach(string subkey_name in key.getsubkeynames()) { using(registrykey subkey = key.opensubkey(subkey_name)) { console.writeline(subkey.getvalue("displayname")); console.writeline(subkey.getvalue("installdate")); } } }
you can use these fields
for more info refer this answer.
you can time using windows installer api! function used msigetproductinfo , property name installproperty_installdate wmi heavyweight.
here more info property taken here
installproperty_installdate: the last time product received service. value of property replaced each time patch applied or removed product or /v command-line option used repair product. if product has received no repairs or patches property contains time product installed on computer.
example:
[dllimport("msi.dll", charset=charset.unicode)] static extern int32 msigetproductinfo(string product, string property, [out] stringbuilder valuebuf, ref int32 len); int32 len = 512; system.text.stringbuilder builder = new system.text.stringbuilder(len); msigetproductinfo("{4b3334ce-06d9-4446-bbc5-eb4c9d75bff6}", "installproperty_installdate", builder , ref len);
Comments
Post a Comment