Set Homepage Via Script

DreadStarX

Well-known member
Joined
Sep 30, 2013
Posts
146
Location
Central/Southern Washington State
Hey guys,


I've been working on this script for some time, and I'm having some issues with it.

Code:
REG ADD "HKCU\Software\Microsoft\Internet Explorer\Main" /V "Start Page" /D "http://www.moseslakeschools.org/" /F


@Echo off
taskkill /im firefox.exe* /f


cd /D "%APPDATA%\Mozilla\Firefox\Profiles"
cd *.default
set ffile=%cd%
echo user_pref("browser.startup.homepage", "https://www.moseslakeschools.org");>>"%ffile%\prefs.js"
set ffile=
cd %windir%

Issues:

1. I need a script to work with Chrome, but I can't figure out HOW to set the "homepage" for Chrome. I found a webpage, but I didn't understand it at all, and I lost it now, haha.
2. I need to bypass the "import" screen of Firefox. I can't seem to figure that one out, or if it is possible at all.


Thanks in Advance,
Thomas
 
Took a bit to find it but here you go:

%APPDATA%\Local\Google\Chrome\User Data\Profile 1\Preferences

(Could be another profile)

line 6562 for me:
Code:
"startup_urls": [ "http://www.google.com" ],
 
Took a bit to find it but here you go:

%APPDATA%\Local\Google\Chrome\User Data\Profile 1\Preferences

(Could be another profile)

line 6562 for me:
Code:
"startup_urls": [ "http://www.google.com" ],


The question now is; how to make this work.


It's coming from a server;

Code:
\\server\server\benchfiles[\code]

[ATTACH=CONFIG]7171.vB[/ATTACH]

This is the Error I get. It doesn't want me to go to "Local" it wants to go to Roaming\Local, like it states. Blah!
 
I have no clue sorry, I just knew where the file was.

I bet John(jcgriff2) would know, he fiddles around with this stuff quite a bit
 
Can you provide the entire batch file you are using for Chrome, please?

Per screenshot error, it's looking for:
Code:
c:\Users\Intern\AppData\Roaming\Local\Google\Chrome\UserData\Profile 1\Preferences

I'm not sure if there is a space between "UserData" or not -- that's where the screenshot wrapped the text.

If the above is correct, the batch code would be:
Code:
"%appdata%\Local\Google\Chrome\UserData\Profile 1\Preferences"

I don't use Chrome, nor do I have it installed.
 
Can you provide the entire batch file you are using for Chrome, please?

Per screenshot error, it's looking for:
Code:
c:\Users\Intern\AppData\Roaming\Local\Google\Chrome\UserData\Profile 1\Preferences

I'm not sure if there is a space between "UserData" or not -- that's where the screenshot wrapped the text.

If the above is correct, the batch code would be:
Code:
"%appdata%\Local\Google\Chrome\UserData\Profile 1\Preferences"

I don't use Chrome, nor do I have it installed.


That didn't quite work. When I try to go there, it gives the same error as above.


Code:
C:\Users\Intern\AppData\Local\Google\Chrome\User Data\Profile 1

If I type in %APPDATA%, it brings me to C:\Users\Intern\AppData\Roaming. It automatically sends me to roaming, and not to Local.


Is there a "wildcard" setup like "%AppData%" for users? like C:\Users\%USERS%\AppData\Local\Google\Chrome\User Data\Profile 1?


I may just end up doing a clean install, taking the preferences file, and duplicating it with the batch file.

replace C:\Users\%USERS%\AppData\Local\Google\Chrome\User Data\Profile 1\ with \\winark\winark\benchfiles\Preferences


That possible too?


Edit:


I work in a school district. We have a domain, I'm trying to setup the home pages for everyone via a script. If I make changes on the Admin account, I want it to reflect on the teacher/student side. That's the end goal.
 
If I type in %APPDATA%, it brings me to C:\Users\Intern\AppData\Roaming. It automatically sends me to roaming, and not to Local.

Sorry, but I'm confused now - the screenshot error said "...\appdata\roaming.." -- not "...\appdata\local...".

%appdata% is a system environment variable = "C:\Users\<username>\AppData\Roaming"

If you don't want "...\appdata\roaming..." and want "...\appdata\local..." instead, then the env var to be used = %localappdata%, not %appdata%

%localappdata% = "C:\Users\<username>\AppData\Local"


Is there a "wildcard" setup like "%AppData%" for users? like C:\Users\%USERS%\AppData\Local\Google\Chrome\User Data\Profile 1?

No - you would use the ENV VAR "%userprofile%", which = "C:\users\<username>"

Here is a list of ENV VAR from my W7 x64 system via SET command:
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\PalmDesert>[B][COLOR="#FF0000"]set[/COLOR][/B]
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\PalmDesert\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=LENOVO1
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\PalmDesert
LOCALAPPDATA=C:\Users\PalmDesert\AppData\Local
LOGONSERVER=\\LENOVO1
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsof
t Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows
\system32;C:\Windows;C:\Windows\System32\Wbem;c:\python27;C:\Program Files\Debugging Tools for Win
dows (x64); K:\WinDDK\7600.16385.1\Debuggers;C:\Program Files (x86)\Windows Live\Shared;C:\Program
 Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Sys
tem32\WindowsPowerShell\v1.0\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=1706
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\PALMDE~1\AppData\Local\Temp
TMP=C:\Users\PALMDE~1\AppData\Local\Temp
USERDOMAIN=LENOVO1
USERNAME=PalmDesert
USERPROFILE=C:\Users\PalmDesert
windir=C:\Windows

C:\Users\PalmDesert>
 
Last edited:
If I type in %APPDATA%, it brings me to C:\Users\Intern\AppData\Roaming. It automatically sends me to roaming, and not to Local.

Sorry, but I'm confused now - the screenshot error said "...\appdata\roaming.." -- not "...\appdata\local...".

%appdata% is a system environment variable = "C:\Users\<username>\AppData\Roaming"

If you don't want "...\appdata\roaming..." and want "...\appdata\local..." instead, then the env var to be used = %localappdata%, not %appdata%

%localappdata% = "C:\Users\<username>\AppData\Local"

Is there a "wildcard" setup like "%AppData%" for users? like C:\Users\%USERS%\AppData\Local\Google\Chrome\User Data\Profile 1?

No - you would use the ENV VAR "%userprofile%", which = "C:\users\<username>"

Here is a list of ENV VAR from my W7 x64 system via SET command:
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\PalmDesert>[B][COLOR=#FF0000]set[/COLOR][/B]
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\PalmDesert\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=LENOVO1
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\PalmDesert
LOCALAPPDATA=C:\Users\PalmDesert\AppData\Local
LOGONSERVER=\\LENOVO1
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsof
t Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows
\system32;C:\Windows;C:\Windows\System32\Wbem;c:\python27;C:\Program Files\Debugging Tools for Win
dows (x64); K:\WinDDK\7600.16385.1\Debuggers;C:\Program Files (x86)\Windows Live\Shared;C:\Program
 Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Sys
tem32\WindowsPowerShell\v1.0\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=1706
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\PALMDE~1\AppData\Local\Temp
TMP=C:\Users\PALMDE~1\AppData\Local\Temp
USERDOMAIN=LENOVO1
USERNAME=PalmDesert
USERPROFILE=C:\Users\PalmDesert
windir=C:\Windows

C:\Users\PalmDesert>


Ok. I don't understand what you've posted above, lmao. I work with Lenovo's and I knew what that was, the rest is all Greek to me.


You've got it correct. Though, I need this script to be applied to every computer I work on. I image a computer via SCCM, and then I login on the Administrator account, and then I install the applications.


My end goal is to create a script, that does this with a click of a button.

1. Installs the cert "cert.cer"
2. Installs the Runtimes from (Ninite)
3. Installs Flash
4. Sets the homepages for the browsers.

The only thing I should have to do is;
1. Name the Computer.
2. Add it to the domain.
3. Check that VNC is installed properly, and update the Password/change it from Domain Creds to VNC Password.


This is the primary end goal. I may have to write a vbscript, and do it that way. Which is TOTALLY out of my league at the moment.
 
Oh.. you are in a server environment - not my forte.

I'll see what I can find out for you, but I don't understand most of what you posted, either!
 
Oh.. you are in a server environment - not my forte.

I'll see what I can find out for you, but I don't understand most of what you posted, either!

It just needs to be something that can be setup to run when someone logins or when a new account is created. I'm trying to make my job simpler, and the next intern.

Plus, this is just good knowledge to have.
 
Instead of changing the settings why not just create some basic profiles and copy them in via script...

You would waste some space but, might be easier if you don't mind overwriting some possible individual user settings.
 
Instead of changing the settings why not just create some basic profiles and copy them in via script...

You would waste some space but, might be easier if you don't mind overwriting some possible individual user settings.


That was my original plan. To just copy the "Preferences" file, which has "http://www.moseslakeschools.org" in it, and the user could edit it from there on out.


- Thomas
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top