Windows Thread, BGInfo via VBS startup script? in Technical; Bit of an odd one I've been battling with so just to try and shed some light on things...
I've ...
-
9th September 2009, 01:01 PM #1 BGInfo via VBS startup script?
Bit of an odd one I've been battling with so just to try and shed some light on things...
I've been using BGInfo via batch files for ages now and it worked really well so I thought I'd go one better and get something to detect the screen res and do the BGInfo that way.
Got a script that reads the resolution via WMI then does the Select Case method to run the right wallpaper. Script runs fine if you run it manually as admin but when put as a startup script it doesn't modify the registry setting for the wallpaper or make the temporary bitmap file 
I'm wondering if it's something to do with the shell.run command I'm using and the security context of the startup script? Seen a few odd bits on Google of similar problems but no real solution or reason behind it... anyone else using VBS and BGInfo to set the logon screen wallpaper?
(The same script works fine for user desktops btw)
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * From Win32_DisplayConfiguration")
Dim shell
Set shell=createobject("wscript.shell")
Dim cmdline1024
cmdline1024="c:\windows\bgibmp\bginfo.exe /i" & "\\domain\sysvol\domain\UserSettings\tools\logon1024.bgi" & " /accepteula /timer:0"
Dim cmdline1680
cmdline1680="c:\windows\bgibmp\bginfo.exe /i" & "\\domain\sysvol\domain\UserSettings\tools\logon1024.bgi" & " /accepteula /timer:0"
Const OverwriteExisting = TRUE
' Determine the size of the desktop
For Each objItem in colItems
X = objItem.PelsWidth
Y = objItem.PelsHeight
Next
strScreenRes = X & "x" & Y
Select Case strScreenRes
Case "1024x768"
Shell.run cmdline1024
set shell=nothing
Case "1680x1050"
Shell.run cmdline1680
set shell=nothing
Case "1920x1200"
Shell.run cmdline1680
set shell=nothing
case Else
Shell.run cmdline1024
set shell=nothing
End Select
Last edited by gshaw; 9th September 2009 at 01:17 PM.
-
-
IDG Tech News
-
9th September 2009, 01:51 PM #2 I am using BG info sucessfully with VBS script.
I have a startup script which copies down the correct wallpapers and the BGinfo program locally to the machine in the same locations for every workstation, but the BGI file is on the netlogon share so I can make clobal changes to it easily. I then use the lines;
Code:
Set objWshShell = CreateObject( "WScript.Shell" )
objWshShell.Run "C:\bginfo\bginfo.exe \\DOMAIN\NETLOGON\BGINFO\Students.bgi /timer:0 /NOLICPROMPT"
To run the program from my student login script. Works like a charm for me
Mike.
-
-
9th September 2009, 02:43 PM #3 I'm guessing that's to change the student desktop background? That works fine for me, it's when I try to execute a BGI file at startup that it seems to break, but only when called via vbscript
-
-
9th September 2009, 03:44 PM #4 Ahhh, yes sorry miss-read your origenal post. That is a login script to modify the student desktop background.
However, I also have it working on a startup script to modify the background before login, but I couldn't get it to work like you are trying to, so I cheated and got it to generate the .BMP file into a folder, and used a Registry hack to get it to display on the logon screen, that works fine but does require a restart of the workstation before it displays.
Startup script runs the BGI file in the same way your script does, but also calls regedit to apply some settings - In the full script there's a marker file placed on the HDD to indicate if this has been run, so it only runs once.
VB script to call registry file
Code:
WshShell.Run "regedt32.exe /s \\DOMAIN\NETLOGON\STUDENTLOGONSETTINGS.REG"
Content of Registry file STUDENTLOGONSETTINGS.REG
Code:
Windows Registry Editor Version 5.00
[HKEY_USERS\.DEFAULT\Control Panel\Desktop]
"Wallpaper"="c:\\bginfo\\system.bmp"
Then get BGinfo to generate its BMP file as C:\BGinfo\system.bmp and that will be your background at the login prompt, works well for me.
Mike
-
-
9th September 2009, 03:55 PM #5 Code:
Select Case strScreenRes
Case "1024x768"
Shell.run cmdline1024
set shell=nothing
Case "1680x1050"
Shell.run cmdline1680
set shell=nothing
Case "1920x1200"
Shell.run cmdline1680
set shell=nothing
case Else
Shell.run cmdline1024
set shell=nothing
End Select Where is the code for the function for cmdlineXXXX where XXXX is the 4 digit number ie 1024 etc ?
-
-
9th September 2009, 04:45 PM #6 Further up the top of the script...
Dim cmdline1024
cmdline1024="c:\windows\bgibmp\bginfo.exe /i" & "\\domain\sysvol\domain\UserSettings\tools\logon10 24.bgi" & " /accepteula /timer:0"
Dim cmdline1680
cmdline1680="c:\windows\bgibmp\bginfo.exe /i" & "\\domain\sysvol\domain\UserSettings\tools\logon10 24.bgi" & " /accepteula /timer:0"
Works lovely at any other point apart from as a startup script, it definitely runs as I've put wscript.echo lines in there to print out the strings and paths but just doesn't seem to have any effect
-
-
9th September 2009, 06:24 PM #7 I've had BGInfo working at Computer Startup, but that's via a CMD and I RoboCopy mirror all the files beforehand (the only thing that bothers me about it is the curious amount of time BGInfo takes to run, typically 10-15 seconds).
I wonder what happens if you get your VBS to call a batch file which just has the BGInfo command line in it. Or better still surround that line with some times:
echo %date% %time:~0,8%: ***** START ***** > c:\bgtest.txt
c:\windows\bgibmp\bginfo.exe ... etc.
echo %date% %time:~0,8%: ***** END ***** >> c:\bgtest.txt
That way you'll at least see whether it's running at all i.e. tiny time = no.
-
-
9th September 2009, 06:46 PM #8 
Originally Posted by
PiqueABoo
I've had BGInfo working at Computer Startup, but that's via a CMD and I RoboCopy mirror all the files beforehand (the only thing that bothers me about it is the curious amount of time BGInfo takes to run, typically 10-15 seconds).
It takes a split second to run on my system.
I've got it setup to customise the wallpaper for students with their user name and logon time in the top right hand corner, and also customise the logon screen with some text that says who the last user to logon to that machine was, trying out the psychology that the users might be less inclined to damage the computers if they know their name's going to be on the front screen when they logoff. Both of these are called from a VBS logon script, although I worked out BGinfo doesn't like it if more than one instance of it is running, so I had to put a delay in the script before it called the second one, but that's only about 2 seconds to allow the first one to complete.
You have to put the /timer:0 in the command or it will take a while, as by default it does have a 15 second delay when you run it with no switches.
Mike.
-
-
9th September 2009, 06:56 PM #9 Just reaslised you're using the /i option. I didn't bother with that and it worked fine for me without it - it may be worth giving it a try without the /i and just the .BGI file immediatly after bginfo.exe just as a possibility.
Mike.
-
-
9th September 2009, 07:50 PM #10 There's no "/i" option mentioned in the help for the version I've got (latest) so I don't use that either. There is a "/log" option though which is probably worth using to help see what's happening with that VBS call.
It takes a split second to run on my system.
Still 5 seconds running it manually logged on as an admin. Don't know, perhaps it depends on the info (I've got IP adresses and computer name in this case).
-
-
9th September 2009, 08:01 PM #11 
Originally Posted by
PiqueABoo
Still 5 seconds running it manually logged on as an admin. Don't know, perhaps it depends on the info (I've got IP adresses and computer name in this case).
Mine is doing machine name, username and time and date of logon. It is slower on wireless laptops, but on my cabled machines it's literally half a second or less for it to run.
Mike.
-
-
10th September 2009, 09:36 AM #12 Tbh I can't remember why the /i switch was on there! Will give it a go without and see what happens
-
-
10th September 2009, 09:33 PM #13 Must admit I haven't had any success with the latest download of it via VBS, tried various version of script from here with no joy so went back to a batch file instead.
-
-
11th September 2009, 12:36 AM #14 
Originally Posted by
john
Must admit I haven't had any success with the latest download of it via VBS, tried various version of script from here with no joy so went back to a batch file instead.
That's a good point, the version I'm using is an older one that I had already downloaded a while back - it does the job so I stuck with it. That may be the difference.
Mike.
-
-
11th September 2009, 10:05 AM #15 Hmmmm I wonder if that's it... maniac what version are you running exactly? Any chance of posting it up so I can try the older one?
Just checked, got v4.14 on one network, v4.12 on the other (that version isn't working via VBS on startup at the moment) and the website shows a v4.15 as the latest one
If not I'll leave BGInfo and just use a reg hack pointing to BMP files I create manually
Last edited by gshaw; 11th September 2009 at 10:12 AM.
-
SHARE:
Similar Threads
-
By GoldenWonder in forum Windows
Replies: 2
Last Post: 10th September 2009, 10:38 PM
-
By Chuckster in forum Windows
Replies: 5
Last Post: 26th February 2009, 01:53 PM
-
By FN-GM in forum Scripts
Replies: 5
Last Post: 18th May 2008, 06:30 PM
-
By ninjabeaver in forum How do you do....it?
Replies: 16
Last Post: 24th August 2007, 12:49 PM
-
By randle in forum Windows
Replies: 4
Last Post: 30th July 2007, 02:56 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules