Sign in to follow this  
Followers 0
clivebuckwheat

How do I use Net use in my RunOnceEx.cmd

16 posts in this topic

it doesn't map to my server drive

Net use u: \\pentium4\unattended\Apps\Firefox

I put this command in the file and it didn't map

0

Share this post


Link to post
Share on other sites

Try calling this vbscript instead, as your batch file will run the vbscript and only continue when the network drive is available and mapped (useful when waiting for a slow wireless net connection to fire up too):

Dim sTestPath
Dim intCount
Dim objnet

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"

End If

Watch out for word wrap there - the whole objnet.MapNetworkDrive section is one line, not two (as it may appear here on the boards).

Edited by cluberti
0

Share this post


Link to post
Share on other sites

thanks but i'd rather just use a simple net use. I just don't understand why it didn't map. Do i need to do something special in the RunOnceEx.cmd to make it work?

see I have a list of apps i want to install from the network.

0

Share this post


Link to post
Share on other sites

Ok you want to add Reg values to install on next reboot but you want the install from a network location instead of local or cd?

Is this right?

have you got network going or is it just your server and the client?

0

Share this post


Link to post
Share on other sites

Yes you got it

my server where the apps are located and a client machine i am installing them to .

All i want to do is a simple net use in the runonceex.cmd

0

Share this post


Link to post
Share on other sites

Perhaps your network interface isn't working? Try putting in an ipconfig /all statement, then a pause, and see if you've even got an IP address.

0

Share this post


Link to post
Share on other sites

I haven't gotten it to work from RunOnce so just call it from a command file someplace like this...

REG ADD %KEY%\075 /VE /D "Mapping Network Drives" /f

REG ADD %KEY%\075 /V 1 /D "%systemdrive%\install\Network\Network.cmd" /f

0

Share this post


Link to post
Share on other sites

ok during the install of windows xp. I map to

u: \\pentium4\unattended\apps

this works fine. it maps. Inside the apps folder there is a firefox folder.

in my runonceex.cmd

i put

REG ADD %KEY%\008 /VE /D "FireFox 1.5" /f

REG ADD %KEY%\008 /V 1 /D "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" /f

i get unable to find \firefox\firefox

what am i doing wrong.

0

Share this post


Link to post
Share on other sites

I think the VBS script that cluberti posted would be the best way to go, you can start the install from it.

Dim sTestPath
Dim intCount
Dim objnet




Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"
'''' Checks to see if it in the correct directory
If objFSO.FileExists("U:\Firefox\Firefox Setup 1.5.0.2.exe") Then
objShell.Run(chr(34) & "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" & chr(34)),1,True
Else
objShell.Popup "Cannot Find This U:\Firefox\Firefox Setup 1.5.0.2.exe",10,"Missing", 0 + 32
End If
End If

0

Share this post


Link to post
Share on other sites

I think the VBS script that cluberti posted would be the best way to go, you can start the install from it.

Dim sTestPath
Dim intCount
Dim objnet




Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"
'''' Checks to see if it in the correct directory
If objFSO.FileExists("U:\Firefox\Firefox Setup 1.5.0.2.exe") Then
objShell.Run(chr(34) & "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" & chr(34)),1,True
Else
objShell.Popup "Cannot Find This U:\Firefox\Firefox Setup 1.5.0.2.exe",10,"Missing", 0 + 32
End If
End If

0

Share this post


Link to post
Share on other sites
REG ADD %KEY%\008 /V 1 /D "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" /f

Note the spaces in your path! You would need it to look like this for what you are currently doing to work:

REG ADD %KEY%\008 /V 1 /D "\"U:\Firefox\Firefox Setup 1.5.0.2.exe\" -ms" /f

0

Share this post


Link to post
Share on other sites

thanks man

that did it.

Now it seems I can't get spybot 1.4 to install and autoupdate. I have checked the forums and even read the spybot faq's

once again what am i doing wrong?

REG ADD %KEY%\009 /VE /D "Spybot Search and Destory 1.4" /f

REG ADD %KEY%\009 /V 1 /D "\"U:\Spybot\spybotsd14.exe\" /verysilent /autoupdate" /f

0

Share this post


Link to post
Share on other sites

What actually happens? Is it that the executable doesn't launch, or it does but doesn't install?

0

Share this post


Link to post
Share on other sites
thanks man

that did it.

Now it seems I can't get spybot 1.4 to install and autoupdate. I have checked the forums and even read the spybot faq's

once again what am i doing wrong?

REG ADD %KEY%\009 /VE /D "Spybot Search and Destory 1.4" /f

REG ADD %KEY%\009 /V 1 /D "\"U:\Spybot\spybotsd14.exe\" /verysilent /autoupdate" /f

Try it without the backslash

REG ADD %KEY%\009 /V 1 /D ""U:\Spybot\spybotsd14.exe" /verysilent /autoupdate" /f

0

Share this post


Link to post
Share on other sites

Every watch way i get

"Do you want to run this type of file"

then I have to click the run box.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.