PowerShell Stuff

To find all PS Commands in your computer

Get-Command

Understanding the Results of the Get-Command Cmdlet

There are four columns in the results of the Get-Command Output

With this information, you can filter the results from Get-Command. Say you want to see PowerShell commands containing the word “EventLog”, running the command below will get the job done:

Get-Command -Name *EventLog

Connect PS to Remote Computer

Enter-PSSession -ComputerName COMPUTER -Credential USER

List All User Password Ages

get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires

List All User Password Expiration Dates

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Find All Locked Account

Search-ADAccount -LockedOut

Fix Common BPA Scan Results on new Windows Servers

Using command prompt as administrator


categories · links · piano · posts · scripts · THEAARBS · home