Ta very much!
Okay that means the error message disappears, but I'm back now with the same problem that I had with the batch script... it just doesn't work. It keeps setting it as the original background (i.e. the non it-suite one).
Ta very much!
Okay that means the error message disappears, but I'm back now with the same problem that I had with the batch script... it just doesn't work. It keeps setting it as the original background (i.e. the non it-suite one).
Kay, I have been playing about with the script a bit, but still can't get it working, even when I've cut half of the script out. I changed it so it should have just worked on my machine, but it still has the same result as above.
(i.e. I changed the script to the following:
The only effect this had on my machine (IT-TECH-02) was to set the background as curric.bgiset oShell=createobject("wscript.shell")
set oNet=createobject("wscript.network")
sComputer=ucase("oNet.computername")
sCmd="%SYSTEMROOT%\bginfo.exe /i""\\SERVER\NETLOGON\BGINFO\curric.bgi"" /timer:0"
if sComputer="IT-TECH-02" then
sCmd="%SYSTEMROOT%\bginfo.exe /i""\\SERVER\NETLOGON\BGINFO\curric-web.bgi"" /timer:0"
end if
oShell.run sCmd.
Also the following doesn't work on my machine:
set oShell=createobject("wscript.shell")
set oNet=createobject("wscript.network")
sComputer=ucase("oNet.computername")
sCmd="%SYSTEMROOT%\bginfo.exe /i""\\SERVER\NETLOGON\BGINFO\logoff.bgi"" /timer:0"
if right(sComputer,2)="02" then
sCmd="%SYSTEMROOT%\bginfo.exe /i""\\SERVER\NETLOGON\BGINFO\logoff-web.bgi"" /timer:0"
end if
oShell.run sCmd
I'm guessing the value of sComputer isn't what we think it is?
do you have the microsoft script debugger installed? If so, use it :-)
It's at http://www.microsoft.com/downloads/d...displaylang=en (if that link doesn't work google for scd10en.exe)
When it's installed, run your script by typing:
<scriptname>.vbs //x
This will launch it in the debugger and you can step through it to see what's going on. The toolbar buttons are not terribly intuitive but the tool tip on one of them is "step into" - click this to step through the program one line at a time. You can click on any line and press F9 to set a breakpoint; if you now press F5 the code will run to that point and then stop. When it's stopped you can open the command window (from the view menu) and check variable values - eg type ?computername to see the value scomputer has.
You can also add lines like:
wscript.echo sComputer
to see the value it has (you probably want to change the default host to cscript to do this - cscript //h:cscript - otherwise you get popups for every "echo")
Okay, just an update on this, I got it working. It was my own fault...
One of the lines was origally given as:
As you can see, there is one speech mark there. I noticed it was wrong but instead of thinking that it shouldn't actually be there, I assumed it's partner had been missed out and added it. This obviously sets the exact value of sComputer to be "oNet.computername". I took the speech marks out and it works perfectly.sComputer=ucase(oNet.computername")
Thanks once again Steve! It's a brilliant script.
There are currently 1 users browsing this thread. (0 members and 1 guests)