Problem:
A client needed to find and remove all of the largest items withing their Exchange databases using PowerShell.
Continue reading “Find large items in Exchange 2010 Using PowerShell”
DailySysAdmin | For all things IT!
A resource for Sys Admins & IT Pros
Problem:
A client needed to find and remove all of the largest items withing their Exchange databases using PowerShell.
Continue reading “Find large items in Exchange 2010 Using PowerShell”
This is a very useful line of code that will list all of the members of a particular Active Directory group and send the output to a .csv file.
Get-ADGroupMember -Identity "Test Group" | export-csv c:\temp\GroupMembers.csv
If you want to find out when user’s passwords will expire and export them to a .csv file then this will help. This simple script will list all of your active users, sort the list and list the expiry dates.
Import-Module ActiveDirectory Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | sort "SamAccountName" | export-csv c:\temp\expire.csv -NoTypeInformation
You can also modify the script so that all you need to do is enter the username and get the expiry date:
Import-Module ActiveDirectory Add-Type -AssemblyName Microsoft.VisualBasic $username = [Microsoft.VisualBasic.Interaction]::InputBox('Enter users SamAccountName', 'SamAccountName') Get-ADUser $username –Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | sort "SamAccountName" | Out-GridView
If you are running the script from a desktop machine ensure that PowerShell is running as admin and that you have the RSAT tools installed.
I have posted on this before but Microsoft has updated the method so I’ll update on here too. To connect your Office 365 instance to PowerShell the process is outlined here. When trying this you may get the error ‘The specified module ‘MSOnline’ was not loaded because no valid module file was found in any module directory.’ The below steps show you how to overcome this. Using the below commands you will also be able to connect to Exchange Online using PowerShell.
Sometimes when trying to find particular updates and troubleshoot Windows update problems you need to be able to manipulate the update data. Using the ‘installed updates’ applet is not always practical. I use the below script to give me a .csv files with all updates installed on a machine.
Continue reading “Use PowerShell to list and export all updates from a Windows machine”
This is just a quick reference for anyone trying to quickly pull off a list of installed software from a remote machine. You will need the remote registry service (you can start this remotely from the services console) and WMI service running on the remote machine.
Continue reading “Use PowerShell to get a list of installed software from remote computers”