Last active
April 13, 2018 07:20
-
-
Save norman-bauer/d62bd815aa768c63fe0c39250f569d4d to your computer and use it in GitHub Desktop.
Upload a user picture from file to Active Directory with vbScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function SavePictureToAD(szADsPath, szLoadFileName) | |
Dim objUser, bytesRead, adoStreamRead | |
Const adTypeBinary = 1 | |
Set adoStreamRead = CreateObject("ADODB.Stream") | |
adoStreamRead.Type = adTypeBinary | |
adoStreamRead.Open | |
adoStreamRead.LoadFromFile szLoadFileName | |
bytesRead = adoStreamRead.Read() | |
adoStreamRead.Close | |
Set objUser = GetObject(szADsPath) | |
objUser.Put "thumbnailPhoto", bytesRead | |
objUser.SetInfo | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment