Solved

Logon scriptes for SBS 2008 - mapped drives and printers

Posted on 2010-08-13
6
1,030 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Assisted Solution

by:Ben Personick (Previously QCubed)
Ben Personick (Previously QCubed) 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
ID: 33628788
thanks for the points! =)
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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