How would I add a RunOnce reg key on a remote machine to have a browser open a webpage

1

Context / Background / Info:

I have local admin access (not domain admin) in a few computer labs that I manage and maintain. I have a script that I use (below) that will reboot computers and log in one time as one user. This script is used as quick way to login all the computers to the desktop environment for logistical reasons and such.

for /F %%i in (foo.txt) do (
start "Addreg %%~ni" reg add "\\%%~ni\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v AutoAdminLogon /t REG_SZ /d 1
start "Addreg %%~ni" reg add "\\%%~ni\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v DefaultUserName /t REG_SZ /d user
start "Addreg %%~ni" reg add "\\%%~ni\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v DefaultDomainName /t REG_SZ /d DOMAIN
start "Addreg %%~ni" reg add "\\%%~ni\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v DefaultPassword /t REG_SZ /d password
start "Addreg %%~ni" reg add "\\%%~ni\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v AutoLogonCount /t REG_DWORD /d 1
start "Restarting %%~ni" shutdown -r -f -m %%~ni -t 10
)    

My question is:

What is the correct syntax to add a RunOnce registry key, in the context of my script, to have a given web-browser open up a webpage one time.

I am assuming along the lines (pseudo)

start addreg \\path\to\key\ **somemagic** firefox.exe openthispage

but as you can see I am not sure.

I have found a lot of information online about how to set the registry key locally, but I have had hard time finding information about using RunOnce remotely to open up a webpage in a given web-browser to boot.

Minor Requirement (if it matters): Please do not use examples with IE if possible. Firefox or Chrome would be most useful

user136952

Posted 2015-05-22T20:14:55.367

Reputation: 121

Answers

1

From Reg add /?

REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]

  KeyName  [\\Machine\]FullKey
       Machine  Name of remote machine - omitting defaults to the
                current machine. Only HKLM and HKU are available on remote
                machines.
       FullKey  ROOTKEY\SubKey
       ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
       SubKey   The full name of a registry key under the selected ROOTKEY.

So

Reg add "\\serenity\HKEY_USERS\S-1-5-21-2820837959-2753176274-143444667-1000\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v MyRunOnceThing /d "iexplore www.microsoft.com"

You have to specify key by user ID.

Neither firefox or opera are part of windows and should never be programmed to. If you want to open a page in the user's browser of choice just exec that page without a program - either http://www.microsoft.com or C:\Windows\Help\mmc\htm\mmc_0.htm.

trigger

Posted 2015-05-22T20:14:55.367

Reputation: 571