|
|
|||||||
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! |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
My drive mappings work fine as well in win7 enterprise |
||||||||
|
|
|||||||
Can I see some of these scripts? |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
I have a VBscript that maps the drives. What is the code to execute the VBscript from witin KIX? |
||||||||
|
|
|||||||
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" |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |