• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1040
  • Last Modified:

Logon scriptes for SBS 2008 - mapped drives and printers

I am migrating across a SBS 2003 standard server to SBS 2008 Standard.  The 2003 server used a kix32.kix file to map network drives via a .bat file.  Any idea what I can use in 2008 SBS?

As well as mapping network drives, I would like to map network printers dependent on what PC they log onto.  I have used previously a .vbs script to do this dependent on Security group membership on a 2003 server but not sure if this would work now on a 2008SBS server.
Any help would be appreciated.
  • 2
  • 2
  • 2
2 Solutions
net use L: \\server\share

that's the simplest way to do it.  How did the logon script run on SBS2003 - using group policy?  You may just want to edit the existing group policy (which would have come across if it's a migration int he same domain) to point it to the new .bat location.  If you need to you can set up different group policy objects for different security groups using filtering.

Your vbs should still work, just edit it with the new paths of the printers.

One thing to bear in mind if the printers are shared from the SBS2008 box is that it's 64-bit, so you'll need to add 32-bit drivers before the clients will just map to it.

buddlesAuthor Commented:
SBS 2003 used the script by having kix32.bat in the logon script in the users account.  This only mapped the drives dependent on group membership.  Ideally I would like this to still only map the appropriate drive mappings dependent on security groups.  I am assuming the .kix format is no longer valid?

Happy to create a new .vbs script for printers and add it to the group policy to map printers.  Any idea what 2008 GPO this should be added to under logon script?

To be honest I don't know kix at all so not sure.

I usually use Group Policy for logon scripts - create a new one for every security group, filter the GPO by its security group and point that to a single .bat file which does the net use and references the vbs script for printers.  Avoid using the existing GPOs as you can get confused real quickly with which GPOs control which scripts.

The other way of doing it is placing people in different OUs in AD and then linking the GPO to the OUs.  This way you can link it to PC or user OUs, but filtering on security group is the obvious way seeing that you already have this configured.

For the VBS script you should just have to change the server\share names in the existing script

O, and initially you may want to do net use L: /d to delete each drive before mapping it as they might have drives mapped to the old server which won't be replaced if you don't run a /d command
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Server 2008 64 (and I assume Vista 64, XP 64, and 7 64) will not run IFMEMBER, AFAIK kix32 is basically functioning the same as IFMEMBER and is also a 32bit app.

And naturally you can;t run a 64 bit app on 32 bit client.  It's very simple to check for this in your batch script though because the Windows comand environemnt contains the %Processor_Architecture% variable whcih will say "AMD64" or "x86" if the OS is 64Bit or 32 bit respectively.

I realized you could get around the 32bit limitation by running dsquery commands, however that will only solve the logon for a 64bit Win2k8 server, since you must be an admin, and must have DSQuery present (not installed by default on client machines though available)
However recently I realized there was an even better way to manage this, so since you requested a method I'd whipped it up, see the attached batch script =)

:: Script Name: Net_Check-Group-Membership.bat													  ::
:: Version: 1.0
:: Copyright: Ben Personick 																	  ::
:: Date: 2010-08-14										  										  ::

		SET "GroupStart=FALSE"
		SET "GroupList=_"
		FOR /F "Tokens=1-3 Delims=*" %%U IN ('net user "%username%" /domain 2^>^&1 ') DO CALL :Start-Check-Membership "%%U" "%%V" "%%W"
		SET GroupList=%GroupList:_, =%
		ECHO GroupList for %UserName%: %GroupList%

			CALL :Start-IFMEMBER "Domain Users"
			IF "%ISMEMBER%"=="NO" GOTO :End-Script
			ECHO "%UserName%" Is a Member of "%IFMEMBER%"
			ECHO NET USE A: \\SERVER\Share\Somedir\ /P
			ECHO NET USE H: \\SERVER\Home$\%UserName%\ /P
			ECHO NET USE P: \\SERVER\Share\Public\ /P

			CALL :Start-IFMEMBER "Operations"
			IF "%ISMEMBER%"=="NO" GOTO End-Map-Operations
			ECHO %UserName% Is a Member of %IFMEMBER%
			ECHO NET USE O: \\SERVER\Share\Operations\ /P
			ECHO NET USE L: \\SERVER\Share\Love\ /P

			CALL :Start-IFMEMBER "Domain Admins"
			IF "%ISMEMBER%"=="NO" GOTO End-Map-Domain-Admins
	GOTO End-Script

			FOR %%G IN (%GroupList%) DO IF /I %%G=="%IFMEMBER%" SET "ISMEMBER=YES"
			SET "Term=%~n1"&SET "GroupA=%~n2"&SET "GroupB=%~n2"
			::ECHO "%Term%" "%GroupA%" "%GroupB%"
			IF /I "%GroupStart%"=="FALSE" FOR /F %%F IN ('ECHO "%Term%" ^| Find /I "Group"') DO SET "GroupStart=TRUE"
			IF /I "%GroupStart%" NEQ "FALSE" SET GroupList=%GroupList%, "%GroupA%", "%GroupB%"

	ECHO The Script Is Exiting.

Open in new window

buddlesAuthor Commented:
Apologies I thought this had been closed off already...
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
thanks for the points! =)

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now