Page 1 of 1 1
Topic Options
#195510 - 2009-08-21 04:48 PM Windows 7 Drive Mapping
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
I'm currently testing Win7 Pro at work. Obviously the drives are not mapping automatically unless I run a script from my desktop. What do I need to add to the script to map drives on Win7? I tried a "if in Group", no luck, NET USE, no luck. Here is the code that calls logon.bat:


 Code:
GOSUB MAPDRIVES
;GOSUB WIN_XP


:MAPDRIVES


CLS
Color Y+/n

AT (20,15) "Mapping Department Drives and Checking Norton AntiVirus Status..."
AT (24,79)

;Shell "\\ Servername \VPLOGON\VPLOGON.BAT"


      
$HOMEDIR=@UserID + "$"

USE H: /DEL
USE H: "\\ Servername \$HOMEDIR"


USE N: /DEL
USE Q: /DEL
USE R: /DEL
USE S: /DEL
USE G: /DEL
USE T: /DEL


USE N: "\\Servername\Dshares\SAP\Documents"
USE Q: "\\Servername \QS9000"
USE R: "\\Servername \DSHARES"
USE S: "\\Servername \GSHARES"
USE G: "\\Servername \APPS"
USE x: "\\Servername \NETWORK_SCANNING"


IF INGROUP ("HEBxWDDrop")
      USE Y: /DEL
      USE Y: "\\ Servername\loftware$\WDDrop"
ENDIF

:UNKNOWN_OS
GOTO END

ENDIF

:END



Here is the script I manually run from the desktop:

 Code:
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "R:", "\\ Servername \DShares" 

On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "N:", "\\ Servername \DShares\SAP" 

On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:", "\\ Servername \GShares" 

On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "Q:", "\\ Servername \QS9000" 


On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "X:", "\\ Servername \Network_Scanning" 

On Error Resume Next
Dim strDriveLetter, strRemotePath, strUserName
strDriveLetter = "H:" 
strRemotePath = "\\ Servername \" 
' Purpose of script to create a network object. (objNetwork)
' Then apply the MapNetworkDrive method. Result H: drive
Set objNetwork = WScript.CreateObject("WScript.Network") 
' Here is where we extract the UserName
strUserName = objNetwork.UserName 
strUserName = strUserName & "$"
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath & strUserName 


msgbox ("Drives Have Been Successfully Mapped")


Would It be better if I added a Group for Win7 users and then call the script or what?

Thanks!


Edited by Mart (2009-08-21 04:56 PM)
Edit Reason: Please use code tags when posting code.

Top
#195511 - 2009-08-21 04:59 PM Re: Windows 7 Drive Mapping [Re: MasterB]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4398
Loc: USA
You are in virgin territory my friend. Ruud, the author of Kixtart has said he needs to update kixtart "if only to address Windows 7", so there may be issues that he is aware of that no one else is. I think there is a few of us who are running 7, but no one that I know of has actually had it running in a corp environment. I'm sure that will change soon though... so keep us included in what you find.
Top
#195512 - 2009-08-21 05:08 PM Re: Windows 7 Drive Mapping [Re: Allen]
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
Thanks for the info. How would I call the VB Script within logon.bat using the "If in Group"? I had it working with Vista but since lost the code to call it, which I stumbled across it anyways.

I think this would be my best bet.

Top
#195513 - 2009-08-21 05:33 PM Re: Windows 7 Drive Mapping [Re: MasterB]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4257
Loc: New Jersey
I had no problems with our login script with the Windows 7 beta or RC versions.. I'm downloading the release version now from MSDN in 32 and 64 bit versions. I'll spin up a pair of VMs once the download is complete and give them a try.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#195514 - 2009-08-21 05:34 PM Re: Windows 7 Drive Mapping [Re: MasterB]
DStelz Offline
Getting the hang of it

Registered: 2007-01-26
Posts: 72
Loc: Green Bay, WI
I guess I'm not 100% sure if this is just a logon script? I am on Windows 7 Enterprise and my login script works fine. I use the Mapdrive function, but I would assume it essentially does the same thing.

I was on 7 RC for quite a while and didn't seen any differences using Kix.


Edited by DStelz (2009-08-21 05:38 PM)

Top
#195515 - 2009-08-21 06:48 PM Re: Windows 7 Drive Mapping [Re: DStelz]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
My drive mappings work fine as well in win7 enterprise
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#195517 - 2009-08-21 06:58 PM Re: Windows 7 Drive Mapping [Re: Radimus]
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
Can I see some of these scripts?
Top
#195518 - 2009-08-21 07:11 PM Re: Windows 7 Drive Mapping [Re: MasterB]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
 Code:
	if ingroup("group1") and not ingroup("group2")
		MapDrive('e',"\\server\CAU",,,1,1)
		MapDrive('g',"\\server\INSP_HQA",,,1,1)
		MapDrive('z',"\\server\MISAPPS",,,1,1)
	endif
	if ingroup("group3")
		MapDrive('i',"\\server\insp_hqa",,,1,1)
		MapDrive('l',"\\server\cau",,,1,1)
		MapDrive('z',"\\server\MISAPPS",,,1,1)
	endif
	if ingroup('group4')
		MapDrive('r','\\server\HCPR',,1,1,1)
	endif 


;*************************************************************************************************************************
Function MapDrive($DriveLetter, $UNC, optional $Label, optional $Icon, optional $Delete, optional $verbose)
	dim $subcmd, $pt, $d, $di, $shell, $text
	$d = left($DriveLetter,1) 
	$di= "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons"
	$pt= @producttype
	$subcmd = iif($pt = "Windows NT Workstation","subst","net use")
	$text = iif($label,$label,' ')
	if $delete
		shell '%comspec% /c $subcmd $d: /d /y 1>Nul 2>&1'
		$nul=deltree("$di\$D")
	endif
	if not exist('$D:\')
		shell '%comspec% /c $subcmd $D: "$UNC" 1>Nul 2>&1'
		if $verbose
			if not @error
				Show('   Connected '+ ucase($driveletter)+ ': to '+ $UNC + '  ( '+ $text + ' )')
				sleep 1
			else
				Show('   FAILED ' + ucase($driveletter)+': Connected to '+ $UNC+ '  ( '+ $text + ' )')
				exit 1
			endif
		endif
	else
		exit 2
	endif
	if $pt="Windows XP Professional" or $pt="Windows 2000 Professional"
		if $Label
			$shell=createobject("shell.application")
			$shell.namespace('$D:\').self.name=$Label
		endif
		if $icon
		 	$=writevalue('$di\$D\DefaultIcon','',$Icon,REG_SZ)
		endif
	endif
ENDFUNCTION
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#195535 - 2009-08-24 08:54 AM Re: Windows 7 Drive Mapping [Re: Radimus]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Note, Show() is a user defined function so you'll need to create a Show() for yourself of replace it wil simple echoing to the console.
Top
#195548 - 2009-08-24 04:17 PM Re: Windows 7 Drive Mapping [Re: Richard H.]
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
I have a VBscript that maps the drives. What is the code to execute the VBscript from witin KIX?
Top
#195549 - 2009-08-24 04:23 PM Re: Windows 7 Drive Mapping [Re: MasterB]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4638
Loc: The Netherlands
You could use shell, run wscript and let is execute the vbs script.
Something like below. I did not test it but is should work imho.

 Code:
Shell "wscript somescript.vbs"
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195550 - 2009-08-24 04:34 PM Re: Windows 7 Drive Mapping [Re: Mart]
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
I added it but it's not working. I added to different lines, does it matter which one I use? Is it in the correct order?

 Code:
 GOSUB MAPDRIVES
;GOSUB WIN_XP


:MAPDRIVES


CLS
Color Y+/n

AT (20,15) "Mapping Department Drives and Checking Norton AntiVirus Status..."
AT (24,79)

;Shell "\\HEBADS006\VPLOGON\VPLOGON.BAT"


SHELL "wscript.exe \\servername\SYSVOL\na.autoedir.com\scripts\Sites\HEB\Win_7.vbs"

Shell "wscript Win_7.vbs"



      
$HOMEDIR=@UserID + "$"

USE H: /DEL
USE H: "\\servername\$HOMEDIR"


USE N: /DEL
USE Q: /DEL
USE R: /DEL
USE S: /DEL
USE G: /DEL
USE T: /DEL


USE N: "\\servername\Dshares\SAP\Documents"
USE Q: "\\servername\QS9000"
USE R: "\\servername\DSHARES"
USE S: "\\servername\GSHARES"
USE G: "\\servername\APPS"
USE x: "\\servername\NETWORK_SCANNING"


IF INGROUP ("HEBxWDDrop")
      USE Y: /DEL
      USE Y: "\\servername\loftware$\WDDrop"
ENDIF



:UNKNOWN_OS
GOTO END


ENDIF

:END

Top
#195635 - 2009-08-27 03:12 PM Re: Windows 7 Drive Mapping [Re: MasterB]
MasterB Offline
Fresh Scripter

Registered: 2009-08-21
Posts: 12
Loc: Kentucky
got it figured out.

Added
 Code:
 VER | find "6.1" > nul
   IF not errorlevel 1 GOTO Win_7


and created a script and then added
 Code:
 :win_7
   IF Exist \\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs START \\servername\sysvol\FQDN\scripts\sites\heb\Startup\win_7.vbs
GOTO END

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 166 anonymous users online.
Newest Members
motkomeri, NHUVY, michaeltoan, scullsol, phanhuyen345
17565 Registered Users

Generated in 0.053 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org