Location: Mail List

Ads

Skyscraper

The GPTalk Mailing List

The GPTALK mailing list is where you can send and receive email related to Windows Group Policy. You must subscribe to the list to send and receive mail from the list. The purpose of the list is to provide a forum for asking and answering technical questions related to Group Policy. Any question is fair game as long as it is related to Windows Group Policy.  The Archives for this list can be found on this page.

 

List Posts

Subject: [gptalk] OT: Script Question
Prev Next
You are not authorized to post a reply.

AuthorMessages
mdzikowskiUser is Offline

Posts:71

01/27/2010 4:35 PM  
How can I Set objADUser to currently logged on user. I want my logon script to check a few things based on the user who is currently logged into a workstation.

TIA!


Mike D

==============================================================================
CONFIDENTIALITY NOTICE: This email contains information from the sender that
may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected
from disclosure. This email is intended for use only by the person or entity
to whom it is addressed. If you are not the intended recipient, any use,
disclosure, copying, distribution, printing, or any action taken in reliance
on the contents of this email, is strictly prohibited. If you received this
email in error, please contact the sending party by reply email, delete the
email from your computer system and shred any paper copies.

Note to Patients: There are a number of risks you should consider before using
e-mail to communicate with us. See our Privacy Policy and Henry Ford My Health
at www.henryford.com for more detailed information. If you do not believe that
our policy gives you the privacy and security protection you need, do not send
e-mail or Internet communications to us.
==============================================================================

JamieNelsonUser is Offline

Posts:166

01/29/2010 6:39 AM  
Here is what I do. Drop this function into your script and then you can
bind directly to the current user or computer.



~~~~~~~~~~~~~~~~~~~~~



Dim objADUser : Set objADUser = GetObject(GetADsPath("user"))

WScript.Echo objADUser.displayName



'--------------------

Function GetADsPath(strObjType)

'--------------------

'Returns the ADsPath of the current user or computer object.



On Error Resume Next

Dim objSysInfo : Set objSysInfo = CreateObject("ADSystemInfo")

Select Case LCase(strObjType)

Case "computer" : GetADsPath = "LDAP://" &
Replace(objSysInfo.ComputerName, "/", "\/")

Case "user" : GetADsPath = "LDAP://" & Replace(objSysInfo.UserName,
"/", "\/")

Case Else : GetADsPath = Null

End Select

Set objSysInfo = Nothing

On Error Goto 0

End Function



~~~~~~~~~~~~~~~~~~~~~





From: xxxxxxxxxxxxxxxx
[mailto:xxxxxxxxxxxxxxxx] On Behalf Of Dzikowski, Michael
Sent: Wednesday, January 27, 2010 10:32 AM
To: xxxxxxxxxxxxxxxx
Subject: [gptalk] OT: Script Question



How can I Set objADUser to currently logged on user. I want my logon
script to check a few things based on the user who is currently logged
into a workstation.



TIA!





Mike D

========================================================================
======
CONFIDENTIALITY NOTICE: This email contains information from the sender
that
may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise
protected
from disclosure. This email is intended for use only by the person or
entity
to whom it is addressed. If you are not the intended recipient, any use,

disclosure, copying, distribution, printing, or any action taken in
reliance
on the contents of this email, is strictly prohibited. If you received
this
email in error, please contact the sending party by reply email, delete
the
email from your computer system and shred any paper copies.

Note to Patients: There are a number of risks you should consider before
using
e-mail to communicate with us. See our Privacy Policy and Henry Ford My
Health
at www.henryford.com for more detailed information. If you do not
believe that
our policy gives you the privacy and security protection you need, do
not send
e-mail or Internet communications to us.
========================================================================
======

Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged.
If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system.

You are not authorized to post a reply.
Forums >GPTalk >GPTalk Mailing List > [gptalk] OT: Script Question



ActiveForums 3.7

Members

MembershipMembership:
Latest New UserLatest:larrys
New TodayNew Today:0
New YesterdayNew Yesterday:1
User CountOverall:1340

People OnlinePeople Online:
VisitorsVisitors:0
MembersMembers:0
TotalTotal:0

Online NowOnline Now:

Ads

Banner Inv
Copyright 2009 by GPOGUY.COM
Terms Of Use