Find a user (or any object) exists in Active Directory


With all Microsoft Active Directory Module for PowerShell, it doesn’t have an cmdlet to simply search a user or group in AD to find it exists or not. Get-ADUser or Get-ADGroup spits an ugly error message if it doesn’t find the object. I wrote an PowerShell function to do exactly what I wanted. Simple search … Continue reading Find a user (or any object) exists in Active Directory

PowerShell: Check the user is member of a Group (including Built-in Groups)


The issue with Get-ADUser JohnDoe –Properties MemberOf cmdlet is it doesn’t list Domain Built-in groups like Domain Users. I am not sure why Microsoft wants to hide built-in groups from listing user group memberships. So I have written a VB Script style function. To use this function, copy & paste this function to your PowerShell … Continue reading PowerShell: Check the user is member of a Group (including Built-in Groups)

RDS 2012R2/Profile Disk: Adobe Reader X says “There was an error opening this document. Access Denied”


PDF attachments from application is not opening correctly. Adobe Reader spits this error message. We use RDS 2012 R2 and Profile Disks for the users. Somehow PDF files on the profile disk is having same issue with Adobe Reader. Solution: It turn out to be new Adobe Reader software has Protected Mode feature. This feature … Continue reading RDS 2012R2/Profile Disk: Adobe Reader X says “There was an error opening this document. Access Denied”

PowerShell: List everything on a OU in a one line


To list all users in a OU, we can get it using Get-ADUser cmdlet. See the example below. (replace OU path in LDAP format to your own stuff and "Import-Module ActiveDirectory" before you run it). Get-ADUser -Filter * -SearchBase "cn=Users,dc=company,,dc=com" -properties title, department| Select-Object name,title,department Now what if you want everything (Users, Groups, Contacts, etc.,) … Continue reading PowerShell: List everything on a OU in a one line

PowerShell: How to return multiple values from a Function?


If you like to return multiple values from a function, simply populate a hash table variable in function and return the variable. See my example below. Feel free to use my example function and Enjoy.   Function Get-UserInfo($username) {     #Create an hashtable variable     [hashtable]$Return = @{}         Import-Module ActiveDirectory        $ADUser = … Continue reading PowerShell: How to return multiple values from a Function?

Make sure the virtual machine’s configuration allows the guest to open host applications


If you see this error on a RDS or Citrix published application, Session host/XenApp server is messed up with file associations. I was trying to open a link to a site in RDS session. That means Internet Explorer is not default program to handle the links or HTM/HTML files. Solution: Remote Desktop to the Session … Continue reading Make sure the virtual machine’s configuration allows the guest to open host applications