+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
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 ...
  1. #1
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,713
    Thank Post
    175
    Thanked 227 Times in 209 Posts
    Rep Power
    68

    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 02:17 PM.

  2. #2

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    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.

  3. #3
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,713
    Thank Post
    175
    Thanked 227 Times in 209 Posts
    Rep Power
    68
    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

  4. #4

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    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

  5. #5

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,983
    Thank Post
    3,531
    Thanked 1,107 Times in 1,014 Posts
    Rep Power
    374
    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 ?

  6. #6
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,713
    Thank Post
    175
    Thanked 227 Times in 209 Posts
    Rep Power
    68
    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

  7. #7

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    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.

  8. #8

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    Quote Originally Posted by PiqueABoo View Post
    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.

  9. #9

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    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.

  10. #10

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    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).

  11. #11

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    Quote Originally Posted by PiqueABoo View Post
    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.

  12. #12
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,713
    Thank Post
    175
    Thanked 227 Times in 209 Posts
    Rep Power
    68
    Tbh I can't remember why the /i switch was on there! Will give it a go without and see what happens

  13. #13

    john's Avatar
    Join Date
    Sep 2005
    Location
    London
    Posts
    10,426
    Thank Post
    1,532
    Thanked 1,066 Times in 931 Posts
    Rep Power
    305
    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.

  14. #14

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,081
    Thank Post
    210
    Thanked 431 Times in 311 Posts
    Rep Power
    145
    Quote Originally Posted by john View Post
    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.

  15. #15
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,713
    Thank Post
    175
    Thanked 227 Times in 209 Posts
    Rep Power
    68
    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 11:12 AM.



SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. VBS startup scripts won't run
    By GoldenWonder in forum Windows
    Replies: 2
    Last Post: 10th September 2009, 11:38 PM
  2. Startup Script
    By Chuckster in forum Windows
    Replies: 5
    Last Post: 26th February 2009, 01:53 PM
  3. Sub within a sub - VBS Script
    By FN-GM in forum Scripts
    Replies: 5
    Last Post: 18th May 2008, 07:30 PM
  4. BGInfo in logon script example?
    By ninjabeaver in forum How do you do....it?
    Replies: 16
    Last Post: 24th August 2007, 01:49 PM
  5. RM CC3 Startup Script
    By randle in forum Windows
    Replies: 4
    Last Post: 30th July 2007, 03: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
  •