Jump to content

AsynchronousCommand runs on every logon


Recommended Posts

Hi,

i built up a nice answer file and added some AsynchronousCommands. One of these commands does something like:

cmd /K echo "test"

When setup has finished and desktop has loaded a cmd window opens... so far so good. But i noticed, that this fucking command runs on every log on, although the documentation says:

AsynchronousCommand specifies a single command to run the first time that a user logs onto the computer.

I checked the registry and find my defined AsynchronousCommands in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

but as far as i know, this is a key where one add to run commands on every log on, like Nvidia drivers or makinboards drivers, you know what i mean?

 

Something is really confusing me...

 

I only want to run a command once on logon. Can someone help?

 

Thanks in advance!

Link to comment
Share on other sites


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

 

This is used to run on every logon just like startup item

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]

but this is used for run only once on next logon but not every time

 

i never given any command in my answer file i just make a self deletable .cmd file and i use the path of it to run 

Edited by kmaheshkumar
Link to comment
Share on other sites

  • 4 weeks later...

I have replicated this using Windows 10 Pro x64 using this XML:

 

<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend">    <settings pass="windowsPE">        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">            <SetupUILanguage>                <UILanguage>en-us</UILanguage>            </SetupUILanguage>            <InputLocale>en-us</InputLocale>            <UILanguage>en-us</UILanguage>            <SystemLocale>en-us</SystemLocale>            <UILanguageFallback>en-us</UILanguageFallback>            <UserLocale>en-us</UserLocale>        </component>    </settings>    <settings pass="oobeSystem">		<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">            <InputLocale>0409:00000409</InputLocale>            <SystemLocale>en-us</SystemLocale>            <UILanguage>en-us</UILanguage>            <UserLocale>en-us</UserLocale>        </component>        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><LogonCommands>   <AsynchronousCommand wcm:action="add">      <CommandLine>cmd /K echo "test"</CommandLine>      <Description>Description_of_command1</Description>      <Order>1</Order>   </AsynchronousCommand></LogonCommands>        </component>    </settings>    <cpi:offlineImage cpi:source="catalog:d:/sources/install_windows vista business.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /></unattend>
Happens using /generalize or not. Writes the contents of CommandLine object to the Run key.

Documentation notes that SynchronousCommand (FirstLogonCommands) now will act like AsynchronousCommnand.

https://msdn.microsoft.com/en-us/library/windows/hardware/dn917933(v=vs.85).aspx

However I tested that and FirstLogonCommand does not write anything into the Run key, and as such does not run on each logon.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...