Question

windows first launch

Asked by: nonubik

Is there a regkey (or something else) that can programaticaly be detected when Windows is launched for the first time after installation?
I have to write an application that must be aware of this 'first launch', under 2000 and above.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-04-21 at 05:34:50ID21397208
Tags

windows

Topic

Windows XP Operating System

Participating Experts
4
Points
0
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Detecting and Launching a different application
    I have a package developed in MSVC 5.0 (let us call this MyApp) I want to do the following in MyApp: a. Provide a toolbar icon that will launch another application. (say, XYZ). b. on startup, MyApp should detect whether XYZ is installed. If not, then the toolbar icon s...
  2. Launching an application
    Dear experts, I know I can put an OLE object on a form and us it to launch an application. I would however like to launch an application by just using code. How would I do this? Thanks Gimola
  3. Launch an Exec
    How to launch single instance of an .Exe from HTML. Thanx
  4. First Attachment launch problem
    I have a form with an attachment. I selected First Attachment Launch option in Form properties and it works fine, but sometimes, the form does not have an attachment and I got an error. Is there any solution for this (urgent)?
  5. Launching a program
    Hi, I'm programming an application in Java, and there is an option to upgrade the program to a new release. When the user selects this option the new program is copied to the local disk, and then I need to automatically launch the new release, and close the existing one. I ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: PeteLongPosted on 2005-04-21 at 05:39:24ID: 13832960

curious how can you install your software prior to the Operating system to detect such a thing? or do you mean it can detect if you are trying to install the software on the "first run" is so there are text files created during setup that have the date and time in them you could check current date and time against the date/time in those logs but you would need to do that programatically which aint my field

 

by: nonubikPosted on 2005-04-21 at 05:43:12ID: 13832983

>curious how can you install your software prior to the Operating system to detect such a thing?
Imagine I have an OPK. Or that I switch windows to Audit mode and back.

> or do you mean it can detect if you are trying to install the software on the "first run"
No, I do not.


I belive my question is clear enough. So please post only pertinent comments.
Thank you very much.

 

by: PeteLongPosted on 2005-04-21 at 05:43:57ID: 13832988

c:\windows\setuplog.txt  has the first install date you would need to parse this out of the log programatically and tompare it to the currrent systemtime, though obviously a reboot in the first 24 hours would sort of knacker this approach :(

 

by: nonubikPosted on 2005-04-21 at 05:52:08ID: 13833047

A timestamp is not reliable as the date/time can be changed.
That's why I was hoping for a regkey.

 

by: craylordPosted on 2005-04-21 at 06:33:25ID: 13833450

Here was my accepted solution.

Just check the time/date stamp from c:\windows\repair\ folder. Specifically the SAM, SECURITY, or SOFTWARE files. These are created when windows is first installed.

http://www.experts-exchange.com/Operating_Systems/WinXP/Q_21386022.html

------------------------------------------------------------
Courtesy of mpfister in the link above.

Here is a solution for XP:

You find the date under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate, but its a binary value and I don't know how to convert it. Or you use a VBScript:

-------------------------------------------------------------
' Script to retrive OS Installation date and time
Option Explicit
On Error Resume Next

Dim obj, objStdOut  

Set objStdOut = WScript.StdOut

' OS Install Date

For Each obj in GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery(_
"Select CurrentTimeZone, InstallDate From Win32_OperatingSystem")
With CreateObject("WbemScripting.SWbemDateTime")
.Value = obj.InstallDate
objStdOut.Writeline vbcrlf & DateAdd("n", -obj.CurrentTimeZone, .GetVarDate) & vbcrlf
End With
Next
WScript.Quit()

-------------------------------------------------------------

Save the text between the lines as InstDate.vbs. Then open a prompt and run

cscript InstDate.vbs

Have fun ..:-)

 

by: nonubikPosted on 2005-04-21 at 07:03:50ID: 13833755

craylord, please be kind and explain me how the *heck* do you know, from the install date, if the Windows 2000/XP/etc. is being launched for the first time?

Seems I post the question in the wrong TA, as I see only windows users here, but programmers.

I'll restate my question: How to know if the current session of windows is JUST the fisrt launch after windows installs? (like the first one when it displays 'windows tour', when the user sees for the first time the windows with the desktop, start menu, etc.). Absolutely *nothing* to do with the installation time.

 

by: craylordPosted on 2005-04-21 at 08:02:54ID: 13834477

You can't know if session is the of windows is the first launch after windows installs. It is a "catch-22". The session would have to know the initial date, plus it would have to know if any other users existed at ANY time and logged on. The session would have absolutely no way to know if a user was created, logged on and removed from the pc. All it knows is its own session. Nothing else. It asks "Is this the first time I've logged on?".

Your example of the the Windows Tour wrong. The Windows Tour is run the first time ANY user logs on. It is not run based on the installation date like your asking or thinking. In order for you to have your program incorporated, you would be better off slipstreaming it into an XP installation, ghost, or copied to the hdd via slaving or a preboot environment.

The Windows Tour is run via the Run Once scenario through the registry, again, not based on the installation date.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xpehelp/html/xegrfrunoncerequesttypesscenarios.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;142633

 

by: m298908Posted on 2005-04-21 at 10:07:59ID: 13836016

Use flag files. Two Options:

Machine First Run:
If you are creating an image, put a flag file a machine (non user specific location) such as C:\Flags\MachineFirstRun.txt.  Then you can run a script on your domain logon script (if you're on a domain) which checks for existence of this flag.  If it's there, then it's the first time the machine is running.  The second step in the script if the file exists would be to rename it or delete it all together.

User First Run:
If you are creating an image, put a flag file in a default user location so that when a new user logs in, the flag file will exist.  Repeat the above step to rename or delete the file once the condition is met.  You can store info which gets deployed to all new users logging into a system under C:\Documents and Settings\Default User\Local Settings.  This would even be immune to roaming profiles since it is the local settings directory.

 

by: nonubikPosted on 2005-04-22 at 03:24:12ID: 13841413

@craylord:

>Your example of the the Windows Tour wrong.
Well, it seems to be just the right example. Because now I can be more specific and say "I'd like to detect if the current window session is the first time a user (any user) logs on after the windows install".

> It is not run based on the installation date like your asking or thinking
I am NOT asking or thinking about installation date. Where have you seen this among my comments? I was just ironic.

>http://support.microsoft.com/default.aspx?scid=kb;en-us;142633
This link is for WinNT only, so no help for my question addresses 2000/XP.


@m298908:

I'm not creating any images. I just have an application that has its entry in HKCU\sowftware\microsoft\windows\currentversion\run. I need this application not to be started :
  1. In Audit mode (done by checking a Windows regkey that exists only while Audit mode)
  2. The user first login (can be done by having a my own flag regkey and check against Audit mode). But I was looking for some Windows regkey for that, too, for I think it's more reliable than having my own flag regkey (error prone if my app crashes while writing the key :o)

 

by: craylordPosted on 2005-04-22 at 06:32:33ID: 13842673

>Your example of the the Windows Tour wrong.
>>Well, it seems to be just the right example. Because now I can be more specific and say "I'd like to detect if the current window session is the first time a user (any user) logs on after the windows install".
  This is a much better question than your posting question. Your posting questions did not specify having users log in. Just when the pc is run for the first time. Much like getting a pc from Compaq and their software setup is finalized before any user logs in. This was my impression.

> It is not run based on the installation date like your asking or thinking
>>I am NOT asking or thinking about installation date. Where have you seen this among my comments? I was just ironic.
Your question implied your program wanted to check if Windows first run after install was happening. How is a program to do this unless there is a date check? Vice versa it's an easier deal. Windows checks for first logon, then runs a program. Not program checks and installs itself. (At least from any reg settings.)

>http://support.microsoft.com/default.aspx?scid=kb;en-us;142633
>>This link is for WinNT only, so no help for my question addresses 2000/XP.
  Yes I know, that is why it was the 2nd link. Sometimes insights or "A-ha's" can be gleened by similar information.

After your rephrased question the first link is just what you need. You would need to add the path to your setup program in this registry key.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\runonce
Add a dword with your program path.
"c:\setup\setup.exe"
or if UNC paths are supported.
"\\server01\share\setup.exe"

Or if your program takes advantage of the all users folder and .default registry entries then you could run your program in this key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\runonceex

 

by: nonubikPosted on 2005-04-22 at 06:45:00ID: 13842827

>You would need to add the path to your setup program in this registry key.

If I place my program under RunOnce, it will be run the very next time a user logs on and the regkey deleted.

I see nothing related to 'windows first launch / user login'.

But I'll just do as I said before: have my flag regkey writen every time I detect an audit mode. Check this flag. If it happens that I have the flag and there is no audit mode, I'll delete the flag regkey and consider the windows session as the 'first launch / user login'.

I have spoken.

 

by: nonubikPosted on 2005-05-29 at 23:00:55ID: 14106728

Hi Page Editor,

Do you see any reason why this shouldn't be PAQed?

 

by: nonubikPosted on 2005-05-30 at 06:54:35ID: 14108095

Thanks.

 

by: moduloPosted on 2005-06-02 at 13:04:22ID: 14134192

PAQed with points refunded (500)

modulo
Community Support Moderator

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...