Solved

Copy files based on "office" property for user on AD in VBscript.

Posted on 2008-09-29
1
232 Views
Last Modified: 2012-05-05
Hi,

I'd like -using VBS - to copy some files to the desktop of users that have "London" as their Office in the Properties of their user account on the AD.

Please advise how to do this?
Many thanks
0
Comment
Question by:Alan-Yeo
1 Comment
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 22597997

Were you looking to run that as a logon script?

Getting the office is moderately straight-forward, see the snippet below.

HTH

Chris

Set objADSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objADSysInfo.UserName)
 
strOffice = objUser.Get("physicalDeliveryOfficeName")
 
Set objUser = Nothing
Set objADSysInfo = Nothing
 
If InStr(strOffice, "London") > 0 Then
    ' Continue on to copying file ...
End If

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
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…
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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