20+ Handy PowerShell SQL Server Scripts
Backup-SSAS:
Backup Analysis Services databases
CheckDB-MSSQL-UsingADO:
Run a DBCC CheckDB with an estimate only on a database
Connect-MSSQL-IPSQLAuth:
Connect to SQL Server with IP address and SQL Authentication
Connect-MSSQL-IPWindowsAuth:
Connect to SQL Server with IP address and Windows Authentication
CreateDB-MSSQL-UsingSMO:
Create a SQL Server database
Create-MSSQLJob-UsingSMO:
Create a job, job step and schedule it
CreateTable-MSSQL-UsingSMO:
Create a SQL Server table
Get-MSSQL-DB-UsingADO:
Run an ADO query to output all databases
Get-MSSQL-DB-UsingSMO:
Enumerate SQL Server database objects using SMO
Get-MSSQL-MaxMemory:
Retrieve max memory setting
Get-MSSQL-Port-UsingDMO:
Get SQL Server port configured using DMO
Get-MSSQL-Port-UsingWMI:
Get SQL Server port configured using WMI
Get-MSSQL-ServerAttrib-Csv:
Enumerate SQL Server attributes using SMO
Get-MSSQL-ServerAttrib-Html:
Enumerate SQL Server attributes using SMO
Get-MSSQL-ServerRegistrations:
Exports current groups and servers
Get-MSSQL-Views-Csv:
List views for a given SQL Server database
Insert-MSSQL-SampleData-Csv:
Insert data from a CSV file into a SQL Server table
List-MSSQL-FailedJobs:
Retrieve failed jobs from SQL Server
List-MSSQL-PropertyInfo:
Display server instance properties using WMI
Load-MSSQL-SMO:
Load SMO assemblies
Start-SQLServerService:
Start and stop a SQL Service
Stop-SQLServerService:
Stop SQL Server service
- SQL Server Scripts
30+ Handy PowerShell Active Directory Scripts
Get-IADUser:
Retrieve all users in a domain or container.
New-IADUser:
Create a new user object in Active Directory.
Set-IADUser:
Modify attributes of a user object in Active Directory.
Enable-UserCannotChangePassword:
Set the 'User Cannot Change Password' checkbox on the user account in ADUC.
Disable-UserCannotChangePassword:
Clears the 'User Cannot Change Password' checkbox on the user account in ADUC.
Get-IADComputer:
Retrieve all computer objects in a domain or container.
Get-IADGroup:
Retrieve all groups in a domain or container that match the specified conditions.
Get-IADEmptyGroup:
Retrieve all groups without members in a domain or container.
New-IADGroup:
Create a new group in Active Directory.
Get-IADGroupMember:
Retrieve the members of a group in Active Directory.
Add-IADGroupMember:
Add one or more objects to a group in Active Directory.
Remove-IADGroupMember:
Remove a member from a group in Active Directory.
Get-IADGroupMembership:
Retrieve all groups to which an object belongs.
Enable-IADObject:
Enable a user or computer object in Active Directory.
Disable-IADObject:
Disable a user or computer object in Active Directory.
Remove-IADObject:
Delete the specified object(s) in Active Directory.
Move-IADObject:
Move one or more objects to a different container in Active Directory.
Get-IADTombstoneUser:
Retrieve all deleted users in Active Directory.
Get-IADTombstoneObject:
Retrieve all deleted objects in Active Directory.
Get-IADTombstoneComputer:
Retrieve all deleted computers in Active Directory.
Get-IADDomainController:
Retrieve domain controller information.
Get-IADDomainController2:
Retrieve domain controllers.
Get-IADCurrentDomain:
Retrieve current domain information like Domain Controllers, DomainMode, Domain Masters, and Forest Root.
Get-IADCurrentForest:
Retrieve current forest information like Domains, Sites, ForestMode, RootDomain, and Forest masters.
Get-IADSubnet:
Retrieve the subnets in a forest or current site.
Get-IADSite:
Retrieve the site(s) information for a forest or current site.
Get-IADFSMORoleHolder:
Retrieve the forest and domain FSMO roles holders.
Get-IADDomainPasswordPolicy:
Retrieve the domain password policy.
New-IADPassword:
Generates a random password of the specified length.
Get-IADObjectSID:
Retrieve AD object's SID.
Get-IADObjectBySID:
Retrieve domain account for known SID.
Get-IADAltRecipient:
Get all objects which has an alternative recipient to receive e-mail.
Get-IADExchangeAdmin:
Retrieve all Exchange 2003 administrators.
- Active Directory Scripts
20+ Handy PowerShell Exchange Scripts
Disable-IEXUser:
Disable Active Directory user, move it to specified location and hide it from the address lists.
Get-IEXAvailableSpace:
Retrieve available space in the database(s) on a mailbox server.
Get-IEXClusterNode:
Retrieve a node in clustered mailbox server (CMS).
Get-IEXCurrentRole:
Retrieve the role of the currently logged on user.
Get-IEXDatabaseQuotaStatistics:
Retrieve all user mailboxes that have custom database quota values and extend the results with custom properties.
Get-IEXDatabaseSize:
Retrieve database size. It must be run on Exchange server.
Get-IEXDatabaseStatistics:
Retrieve database info.
Get-IEXEmailAddressOwner:
Find who owns an email address.
Get-IEXEmailAddressReport:
Enumerate email addresses.
Get-IEXForwardMailbox:
List users with email forwarding enabled (with or without delivering a copy to the original recipient).
Get-IEXInactiveMailbox:
Retrieve inactive mailbox by checking the latest email in SentItems folder.
Get-IEXLastSendAndReceivedDate:
Retrieve the newest/oldest email item dates for each mailbox.
Get-IEXMailboxAddressCount:
Get email addresses count for all users.
Get-IEXMailboxCountReport:
Get mailbox count per mailbox database.
Get-IEXMailboxFolderStatistics:
Extend MailboxFolderStatistics object, including Newest and Oldest Item Received Date members in days.
Get-IEXMailboxStatistics:
Retrieve extended mailbox statistics information.
Get-IEXSendAsPermission:
Retrieve the users that have "Send As" permission.
Get-IEXTip:
Enhanced built-in function Get-Tip with Online switch to list online version of 'Exchange Management Shell Tips of the Day'.
New-IEXAddressList:
Create new address list from distribution group.
New-IEXMailboxFromCsv:
Create mailbox using data from CSV file.
New-IEXTestMailbox:
Use the function to create a test user in the Active Directory and mailbox-enable this new user.
Purge-IEXMailbox:
Permanently delete mailbox(s) from a database.
Remove-IEXDisabledUser:
Delete all disabled user accounts and associated mailboxes (or mark them for removal).
Set-IEXEmailAddress:
Add/remove email address. Set it as primary optionally.
Test-IEXDistinguishedName:
Check the validity of distinguished name string.
Test-IEXEmailAddress:
Check the validity of an email address.
Test-IEXEmailAddress2:
Check the validity of an email address using .NET Framework method.
- Exchange Scripts
15+ Handy PowerShell SharePoint Scripts
Add-SPSite:
Adds a new SharePoint site
Import-SPSite:
Imports a site from a backup file
Export-SPSite:
Exports a site to a backup file
Get-SPWeb:
Gets a SharePoint web site
Remove-SPSite:
Removes a site from the site collection
Add-SPList:
Creates a new SharePoint list
Display-SPList:
Displays all lists
Remove-SPList:
Removes a list
Get-SPView:
Gets a SharePoint view
Display-SPItemInformation:
Displays detailed item information
Set-SPItem:
Modifies a list item
CheckIn-SPDocument:
Checks in a document in SharePoint
CheckOut-SPDocument:
Checks out a document in SharePoint
Display-SPWebPart:
Displays all web parts
Add-SPUser:
Adds a new user to a group in SharePoint
For the complete set of more than 60 free SharePoint scripts authored by SharePoint expert Niklas Goude, download a free 30-day trial of Idera’s PowerShell Plus and look in the QuickClick Library SharePoint tab.
- SharePoint Scripts