Solved

Using script to apply domain-wide settings

Posted on 2011-09-08
1
337 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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Suggested Solutions

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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