Solved

Logon scriptes for SBS 2008 - mapped drives and printers

Posted on 2010-08-13
6
1,026 Views
Last Modified: 2012-08-13
Hi,
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.
0
Comment
Question by:buddles
  • 2
  • 2
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
ebooyens earned 300 total points
ID: 33429663
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.

http://blogs.technet.com/b/sbs/archive/2009/02/13/how-to-add-32-bit-print-drivers-to-sbs-2008.aspx
0
 

Author Comment

by:buddles
ID: 33429789
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?

0
 
LVL 4

Expert Comment

by:ebooyens
ID: 33429912
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
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 11

Assisted Solution

by:Ben Personick
Ben Personick earned 200 total points
ID: 33435518
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										  										  ::
::------------------------------------------------------------------------------------------------::

:Begin-Script
	ECHO OFF
	:Start-Prep
		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%
	:End-Prep


	:Start-Main
	
		:Start-Map-Domain-Users
			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
		:End-Map-Domain-Users

		:Start-Map-Operations
			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
		:End-Map-Operations

		:Start-Map-Domain-Admins
			CALL :Start-IFMEMBER "Domain Admins"
			IF "%ISMEMBER%"=="NO" GOTO End-Map-Domain-Admins
			ECHO NET USE I: \\SERVER\Share\IT\ /P
		:End-Map-Domain-Admins
		
	:End-Main
	GOTO End-Script

	:Start-Subs
		:Start-IFMEMBER
			SET "IFMEMBER=%~1"&SET "ISMEMBER=NO"
			ECHO IFMEMBER == %IFMEMBER% and ISMEMBER == %ISMEMBER%
			FOR %%G IN (%GroupList%) DO IF /I %%G=="%IFMEMBER%" SET "ISMEMBER=YES"
			ECHO IFMEMBER == %IFMEMBER% and ISMEMBER == %ISMEMBER%
			GOTO :EOF
		:End-IFMEMBER
		:Start-Check-Membership
			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%"
			GOTO :EOF
		:End-Check-Membership
	:End-Subs

:End-Script
	ECHO The Script Is Exiting.

Open in new window

0
 

Author Closing Comment

by:buddles
ID: 33625384
Apologies I thought this had been closed off already...
0
 
LVL 11

Expert Comment

by:Ben Personick
ID: 33628788
thanks for the points! =)
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because virtualization becomes more and more common, and, with Microsoft Hyper-V included in Windows Server at no additional costs, and, most server hardware nowadays is more than capable of running a physical Small Business Server (SBS) 2008 or 201…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now