Solved

Using script to apply domain-wide settings

Posted on 2011-09-08
1
339 Views
Last Modified: 2012-05-12
I have a small network of Windows-based computers, PCs running Windows XP or Windows 7 and servers running Windows 2008 or Windows 2008 R2. I need to roll out some changes to all my PCs, some 60+ PCs and I am wondering whether vb script could help me. The two tasks I need to complete are as follows:-

1. I need to set a default wallpaper on every PC. I would ideally like the wallpaper to be a series of photos that would be copied to a specific folder on the PC.

2. We have a single login script for every user so we map the same network drives for evrybody, regardless of whether they need them or not. I'd like to create a script that would map a drive based on whether they belong to a particular security group or not.

I found an article on EE where someone had a similar issue and vb script was suggested as a solution http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_22686588.html and I'm sure vb script can help with my secod issue but I know nothing about vb script and how to use it.

Can anybody suggest where I start with vb script? Are there any good websites or books that you can recommend?
0
Comment
Question by:infologicit
1 Comment
 
LVL 4

Accepted Solution

by:
David Linker earned 500 total points
ID: 36508305
You can resolve both of these problems by modifying your existing Login script.

The below will map your drives based on group membership.

The background files solution to come shortly - need to test on both Windows XP and Windows 7

Option Explicit
Dim objNetwork, objUser, objCurrentUser
Dim strGroup

' Create objects and retrieve strGroup values
Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(objCurrentUser.MemberOf))

' If logic testing strGroup for the values in Const groups
If InStr(strGroup, lcase("cn=group-to-match-in-all-lower-case")) Then
	objNetwork.MapNetworkDrive "h:", "\\MainServer\Users\" & objNetwork.UserName
ElseIf InStr(strGroup, lcase("cn=some-other-group")) Then
	objNetwork.MapNetworkDrive "h:", "\\DifferentServer\Users\" & objNetwork.UserName
End If

If InStr(strGroup, lcase("cn=some-special-group")) Then
	objNetwork.MapNetworkDrive "g:", "\\Server\SpecialShare"
End If
Wscript.Echo "Completed mapping drives "
WScript.Quit

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

860 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