VBScript question
#1
Scooby Regular
Thread Starter
VBScript question
Right, I have a very simple script file which installs some printers for a workstation. Now I want to run this for every user, but not through a login script.
I tried using AT and PSEXEC to push the script out to the clients, but the don't like (or simply won't) execute VBScript.
Can a script file be compiled into an .exe binary or do I need to re-write it in VB (or whatever else)?
Stefan
I tried using AT and PSEXEC to push the script out to the clients, but the don't like (or simply won't) execute VBScript.
Can a script file be compiled into an .exe binary or do I need to re-write it in VB (or whatever else)?
Code:
'VB script to add printers Set WshNetwork = CreateObject("WScript.Network") Dim MyVar PrinterPath = "\\svr-liv-dc1\HP4050N" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc1\HP4050NA" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc1\HP4050NB" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc1\HP1220C" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc1\EPC900" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc2\HP4050N" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc2\HP4050NA" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc2\HP4050NB" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc2\HP1220C" WshNetwork.AddWindowsPrinterConnection PrinterPath PrinterPath = "\\svr-liv-dc2\EPC900" WshNetwork.AddWindowsPrinterConnection PrinterPath
#3
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
How do you want it to run.. if your using something like at then did you use /interactive..
What OS are on the remote machines? what rights do you have on them.. I have a script that will remotely execute things??
What OS are on the remote machines? what rights do you have on them.. I have a script that will remotely execute things??
#4
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
Code:
strComputer = "webserver" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process") Error = objWMIService.Create("notepad.exe", null, null, intProcessID) If Error = 0 Then Wscript.Echo "Notepad was started with a process ID of " _ & intProcessID & "." Else Wscript.Echo "Notepad could not be started due to error " & _ Error & "." End If
#5
Scooby Regular
Thread Starter
Jods,
No, I've never heard of those otherwise I would have
David,
Machines are all XP and I have full admin rights to our domain and PC's. If I save my code as .vbs it runs perfectly. Rather than asking the users to run it I want it to launch on their workstations (as the current logged in user). Basically as if I walked up to the desktops and just asked the user to run the VBScript.
Stefan
No, I've never heard of those otherwise I would have
David,
Machines are all XP and I have full admin rights to our domain and PC's. If I save my code as .vbs it runs perfectly. Rather than asking the users to run it I want it to launch on their workstations (as the current logged in user). Basically as if I walked up to the desktops and just asked the user to run the VBScript.
Stefan
#7
Scooby Regular
Thread Starter
Even tried using Dameware, but all the remote commands want to use my username and profile. I need to use the currently logged on users profile/environment to launch the utility.
Oh, well looks like I'll need to get them to run the file themselves.
Stefan
Oh, well looks like I'll need to get them to run the file themselves.
Stefan
Trending Topics
#9
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
Bored? Work in IT?
I'm bored...
Save the following as something like lock.vbs
ammend the computernamehere to the target pc's hostname....
then type cscript lock.vbs
and there pc locks.. funny as **** watching their faces..
David
Save the following as something like lock.vbs
ammend the computernamehere to the target pc's hostname....
then type cscript lock.vbs
and there pc locks.. funny as **** watching their faces..
David
Code:
strComputer = "ComputerNameHere" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process") Error = objWMIService.Create("rundll32.exe user32.dll,LockWorkStation", null, null, intProcessID) If Error = 0 Then Wscript.Echo "Sucesss" Else Wscript.Echo "Failed" End If
#11
Scooby Regular
Thread Starter
Don't worry I'm as fed up as you this afternoon (he says with copy of Evo in front of him). Now, who shall I try this out on ..............
Stefan
Stefan
#14
The task scheduler should be able to launch VBS. Did you explicitly prefix the command with the CSCRIPT.EXE interpreter? Not sure how this will work with the currently logged on user. I agree /interactive will get it to run on the desktop, but still not sure who's HKCU reg hive gets updated.
You say you don't want to run it as part of the logon script - any reason?
You say you don't want to run it as part of the logon script - any reason?
#15
Scooby Regular
Thread Starter
Nog, I didn't. cscript.exe should work with the vbs file - good thinking
The users never logout. I keep telling them Microsoft like reboots
Stefan
The users never logout. I keep telling them Microsoft like reboots
Stefan
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM