Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

How do I use Net use in my RunOnceEx.cmd

- - - - -

  • Please log in to reply
15 replies to this topic

#1
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
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


How to remove advertisement from MSFN

#2
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,253 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag
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, 14 April 2006 - 10:42 PM.

MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#3
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
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.

#4
p4ntb0y

p4ntb0y

    Member

  • Member
  • PipPip
  • 237 posts
  • Joined 14-February 06
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?

#5
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
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

#6
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,253 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag
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.
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#7
mc134

mc134

    Junior

  • Member
  • Pip
  • 67 posts
  • Joined 15-January 04
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

#8
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
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.

#9
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,430 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
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




GunSmokingMan



#10
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,430 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
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




GunSmokingMan



#11
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,253 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag

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
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#12
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
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

#13
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
anyone? with spybot issues

#14
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,253 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag
What actually happens? Is it that the executable doesn't launch, or it does but doesn't install?
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#15
Ghostrider

Ghostrider

    Member

  • Member
  • PipPip
  • 177 posts
  • Joined 29-January 04

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

#16
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 577 posts
  • Joined 07-November 05
Every watch way i get

"Do you want to run this type of file"

then I have to click the run box.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users