arichee
asked on
creating a service that maps a network drive
I wrote and compiled the below module that maps the z: drive to a remote server, then added the executable as a service via INSTSRV. But when I attempt to start the service, it errors saying it can't start the service. What could be causing this?
Sub Main()
Set WshShell = CreateObject("WScript.Shel l")
WshShell.Run ("net use z: \\server\c$ /persistent:yes")
End Sub
Sub Main()
Set WshShell = CreateObject("WScript.Shel
WshShell.Run ("net use z: \\server\c$ /persistent:yes")
End Sub
ASKER
The error occurs when I attempt to start the service manually from the Computer Manager in Win2000.
Than I have no clue. Perhaps someone else will chime in.
Anthont
Anthont
How did you install the service with instsrv ? there are a few more steps than just running instsrv ProgramName.exe
Why would you want to run this as a service.After it maps the drive what is it supposed to do,just keep running?
ASKER
From the command line, I typed "instsrv MAPZDRIVE c:\mapzdrive.exe," where mapzdrive.exe is the VB module below:
Sub Main()
Set WshShell = CreateObject("WScript.Shel l")
WshShell.Run ("net use z: \\server\c$ /persistent:yes")
End Sub
Sub Main()
Set WshShell = CreateObject("WScript.Shel
WshShell.Run ("net use z: \\server\c$ /persistent:yes")
End Sub
ASKER
I want it as a service, so the z: drive will be mapped whether you're logged in or not.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Anthony