We help IT Professionals succeed at work.

vbscript for running BGInfo in Terminal Server 2003

chekfu
chekfu asked
on
Hi Expert

I have two files: BGInfo.exe and TSWallpaper.bgi, save onto DFS path \\tcf.local\Support\TSTemplate.

I have the following vbscript:
Set objShell = WScript.CreateObject("WScript.Shell")
Username = "tcf.local\administrator"
Password = "password"
objShell.run "\\tcf.local\support\TSTemplate\BGInfo.exe TSWallpaper.bgi /timer:0 /SILENT /NOLICPROMPT",1 ,true

I logon as domain user account, it prompts for no permission to write into C:\WINDOWS folder.

Please help!
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Hi, I take it this command installs a screen-saver, which would copy files to the C:\Windows folder:
"\\tcf.local\support\TSTemplate\BGInfo.exe TSWallpaper.bgi /timer:0 /SILENT /NOLICPROMPT"

and a normal user is not going to have the rights to copy files there.
If you need to install the screensaver, you should be able to that as Admin, and it will be available to all users.  Otherwise, if you're trying to configure a timeout for the screensaver, you should be able to do this via Group Policy.

Regards,

Rob.

Author

Commented:
Hello all

I managed to resolved it myself. Like to share. Here it go!

Set objShell = WScript.CreateObject("WScript.Shell")
'-------- DEFINE THE PROGRAM FILE LOCATION ---------
strExecuteFile = "\\tcf.local\Support\TSTemplate\bginfo.exe /NOLICPROMPT /timer:0 /all"

'-------- DEFINE THE CONFIGURATION FILE LOCATION ---------
'strConfigurationFile = ("\\tcf.local\Support\TSTemplate\TSWallpaper.bgi")

'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & strConfigurationFile
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Hi, that's great.  Doesn't seem like it would avoid any Unable to Write to Windows folder problem though, but as long as it works!

You should post a request in the Community Suport --> General zone to have this question either PAQed or deleted.

Regards,

Rob.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Hi chekfu, I think that BGInfo does behave in a situation where it requires Admin rights (or at least specific rights to write to the Windows folder and certain parts of the registry).  I think that to provide this ability, you will need to copy your TSTemplate folder into the NetLogon folder of a domain contoller.  Then you can run a StartUp script, instead of a Login script, which will run under the system account, and you should be able to use the /all switch.  So, once you have moved the folder, you can use this:

Set objShell = WScript.CreateObject("WScript.Shell")
'-------- DEFINE THE PROGRAM FILE LOCATION ---------
strExecuteFile = "\\domain.com\sysvol\domain.com\scripts\TSTemplate\bginfo.exe /NOLICPROMPT /timer:0 /all"

'-------- DEFINE THE CONFIGURATION FILE LOCATION ---------
'strConfigurationFile = ("\\domain.com\sysvol\domain.com\scripts\TSTemplate\TSWallpaper.bgi")

'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & strConfigurationFile


Regards,

Rob.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Hi chekfu, as oBdA mentioned in the other post of yours, change this:
'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & strConfigurationFile

to this
'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & " " & strConfigurationFile

Regards,

Rob.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.