PowerShell scripts have been developed that perform the same functions as several of the VBScript programs on this site. This page collects all of these PowerShell scripts in one place. Below is a button to the page where each PowerShell script is linked, plus a direct link to the script itself. All of the PowerShell scripts will work in either PowerShell V1 or V2, unless otherwise indicated.
Find and report on all instances of circular group nesting in the domain.
PSCircularNestedGroups.txt <<-- Click here to view or download the PowerShell script
Programs to output the last logon date for all users in the domain. The
second script requires PowerShell V2. The third program reads user
"pre-Windows 2000 logon names" from a text file.
PSLastLogon.txt <<-- Click here to view or download the program
PSLastLogon2.txt <<-- Click here to view or download the program
PSLimitedLastLogon.txt <<-- Click here to view or download the program
Discussion of Integer8 attributes, including scripts to convert to and from
dates.
PSInteger8ToDate.txt <<-- Click here to view or download the program
PSDateToInteger8.txt <<-- Click here to view or download the program
Program to determine the date a user last changed their password, the domain
maximum password age policy, whether the user is allowed to change their
password, and if the password is expired.
PSPwdLastSet.txt <<-- Click here to view or download the program
Program to output the date each user in the domain last changed their
password.
PSPwdLastChanged.txt <<-- Click here to view or download the program
Program to find all users whose password will expire between now and a
specified number of days in the future.
PSPwdExpires.txt <<-- Click here to view or download the program
An efficient method to quickly retrieve the names of all users currently
locked out.
PSFindLockedOutUsers.txt <<-- Click here to view or download the program
Program to document all groups that a specified user is a member of.
PSEnumUserGroups.txt <<-- Click here to view or download the program
Program to document all members of a group in Active Directory.
PSEnumGroup.txt <<-- Click here to view or download the program
Documents the organizational structure indicated by the Manager and
Direct Reports fields on the "Organization" tab of the user properties
dialog of Active Directory Users and Computers.
PSOrganization.txt <<-- Click here to view or download the program
Use ADO to retrieve information on all users and document in a comma delimited file.
PSDocumentUsers.txt <<-- Click here to view or download the program
Document all members of a local group, including domain groups and users.
PSEnumLocalGroup.txt <<-- Click here to view or download the program
Program to identify, disable, and move inactive computer accounts.
PSMoveOldComputers.txt <<-- Click here to view or download the program
Demonstrates how to test security group membership for a single user or computer.
Uses the tokenGroups attribute.
PSIsMember4.txt <<-- Click here to view or download the program
Demonstrates how to test security group membership for any number of users or computers.
Uses the tokenGroups attribute.
PSIsMember5.txt <<-- Click here to view or download the program
Demonstrates how to test security group membership for any number of users or computers.
Uses the tokenGroups attribute and ADO to retrieve the names of the
groups. This should be faster if your users are members of many groups.
PSIsMember8.txt <<-- Click here to view or download the program
Program to use DirectorySearcher to query Active Directory for information. The
program prompts for the base of the search, the LDAP syntax filter, and
the comma delimited list of attribute values to retrieve. This program
can be used to test various filters.
PSGenericADO.txt <<-- Click here to view or download the program
Program to document the logonHours property of a user. This property defines the hours
in the week that the user is allowed to logon in the domain.
PSLogonHours.txt <<-- Click here to view or download the program
Program to document the LogonHours attribute for all users in the domain.
PSAllUsersLogonHours.txt <<-- Click here to view or download the program
A PowerShell script to assign values to the logonHours attribute of users in
bulk from the information in a comma delimited file. This assigns the
hours in the week when the users are allowed to logon to the domain.
PSSetLogonHours.txt <<-- Click here to view or download the program
PowerShell Version 1.0 script to update users in bulk from the information in a
Microsoft Excel
Spreadsheet. Only single-valued string attributes can be updated with
this program.
PSUpdateUsers.txt <<-- Click here to view or download the program
PowerShell Version 1.0 script to enumerate all direct members of any Active
Directory group, even if there are more than 1500 members.
PSEnumLocalGroup.txt <<-- Click here to view or download the program