Windows Script

Diaonic

Senior member
May 3, 2002
305
0
0
I'm hoping someone here could help me out with a script that I need to implement a new CRM system.

The script needs to be able to kill an active process IF it's running
I also need it to mount a network drive with user credentials. ( kinda like the net use \\server\share /user:Domain\username password )

Thanks
 

KB

Diamond Member
Nov 8, 1999
5,404
386
126
This is code for vbscript:

More examples can be found at http://msdn.microsoft.com/scripting/

'kill a process

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'explorer.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

'map a network drive
Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.MapNetworkDrive "E:", "\\Server\Public", false, "username", "password"