If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.
' Change the following line to the OU you want to hide strOUpath = "****" ' This will do the target OU and everything under it Const ADS_SCOPE_BASE = 0 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_BASE objCommand.CommandText = "SELECT ADsPath, objectClass, objectCategory FROM 'LDAP://" & strOUpath & "'" Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF strClass = objRecordSet.Fields("objectClass").Value strCategory = objRecordSet.Fields("objectCategory").Value If strClass = "user" OR strCategory = "person" Then strUserPath = objRecordSet.Fields("ADsPath").Value Set objUser = GetObject(strUserPath) objUser.MSExchHideFromAddressLists = TRUE objUser.SetInfo End If objRecordSet.MoveNext Loop
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.