| Author | Messages | |
mdzikowski
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. ==============================================================================
| | | |
| JamieNelson
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.
| | | |
|
|