full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaPowerPlan.ps1
Test-DbaPowerPlan.ps1
Function Test-DbaPowerPlan { <# .SYNOPSIS Checks SQL Server Power Plan, which Best Practices recommends should be set to High Performance .DESCRIPTION Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server. Specify -Detailed for details. Referenc...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaAgentJobOutputFile.ps1
Set-DbaAgentJobOutputFile.ps1
Function Set-DbaAgentJobOutputFile { <# .Synopsis Sets the OutPut File for a step of an agent job with the Job Names and steps provided dynamically .DESCRIPTION Sets the OutPut File for a step of an agent job with the Job Names and steps provided dynamically if required .PARAMETER SqlInstance The S...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaAgentAlert.ps1
Get-DbaAgentAlert.ps1
FUNCTION Get-DbaAgentAlert { <# .SYNOPSIS Returns all SQL Agent alerts on a SQL Server Agent. .DESCRIPTION This function returns SQL Agent alerts. .PARAMETER SqlInstance SqlInstance name or SMO object representing the SQL Server to connect to. This can be a collection and receive pipeline input. ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaJobCategory.ps1
Get-DbaJobCategory.ps1
FUNCTION Get-DbaJobCategory { <# .SYNOPSIS Gets SQL Agent Job Category information for each instance(s) of SQL Server. .DESCRIPTION The Get-DbaJobCategory returns connected SMO object for SQL Agent Job Category information for each instance(s) of SQL Server. .PARAMETER SqlInstance SQL Server name or SMO o...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlLinkedServer.ps1
Copy-SqlLinkedServer.ps1
Function Copy-SqlLinkedServer { <# .SYNOPSIS Copy-SqlLinkedServer migrates Linked Servers from one SQL Server to another. Linked Server logins and passwords are migrated as well. .DESCRIPTION By using password decryption techniques provided by Antti Rantasaari (NetSPI, 2014), this script migrates SQL Server ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaPermission.ps1
Get-DbaPermission.ps1
Function Get-DbaPermission { <# .SYNOPSIS Get a list of Server and Database level permissions .DESCRIPTION Retrieves a list of permissions Permissions link principals to securables. Principals exist on Windows, Instance and Database level. Securables exist on Instance and Database level. A permission stat...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Show-SqlServerFileSystem.ps1
Show-SqlServerFileSystem.ps1
Function Show-SqlServerFileSystem { <# .SYNOPSIS Shows file system on remote SQL Server and returns the directory name of the directory you select. .DESCRIPTION Similar to the remote file system popup you see when browsing a remote SQL Server in SQL Server Management Studio, this command allows you to traverse...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-DbaLoginInGroup.ps1
Find-DbaLoginInGroup.ps1
function Find-DbaLoginInGroup { <# .SYNOPSIS Finds Logins in Active Directory groups that have logins on the SQL Instance. .DESCRIPTION Outputs all the active directory groups members for a server, or limits it to find a specific AD user in the groups .NOTES Original Author: Stephen Bennett, https://sqln...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Remove-SqlDatabaseSafely.ps1
Remove-SqlDatabaseSafely.ps1
Function Remove-SqlDatabaseSafely { <# .SYNOPSIS Safely removes a SQL Database and creates an Agent Job to restore it .DESCRIPTION Performs a DBCC CHECKDB on the database, backs up the database with Checksum and verify only to a Final Backup location, creates an Agent Job to restore from that backup, Drops the ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaServerProtocol.ps1
Get-DbaServerProtocol.ps1
Function Get-DbaServerProtocol { <# .SYNOPSIS Gets the SQL Server related server protocols on a computer. .DESCRIPTION Gets the SQL Server related server protocols on one or more computers. Requires Local Admin rights on destination computer(s). The server protocols can be enabled a...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/New-DbaSsisCatalog.ps1
New-DbaSsisCatalog.ps1
Function New-DbaSsisCatalog { <# .SYNOPSIS Enables the SSIS Catalog on a SQL Server 2012+ .DESCRIPTION After installing the SQL Server Engine and SSIS you still have to enable the SSIS Catalog. This function will enable the catalog and gives the option of supplying the password. .PARAMETER SqlInstance SQL...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaServerName.ps1
Test-DbaServerName.ps1
Function Test-DbaServerName { <# .SYNOPSIS Tests to see if it's possible to easily rename the server at the SQL Server instance level, or if it even needs to be changed. .DESCRIPTION When a SQL Server's host OS is renamed, the SQL Server should be as well. This helps with Availability Groups and Kerberos. Th...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlServerTrigger.ps1
Copy-SqlServerTrigger.ps1
Function Copy-SqlServerTrigger { <# .SYNOPSIS Copy-SqlServerTrigger migrates server triggers from one SQL Server to another. .DESCRIPTION By default, all triggers are copied. The -Triggers parameter is autopopulated for command-line completion and can be used to copy only specific triggers. If the trigger ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaValidLogin.ps1
Test-DbaValidLogin.ps1
Function Test-DbaValidLogin { <# .SYNOPSIS Test-DbaValidLogin finds any logins on SQL instance that are AD logins with either disabled AD user accounts or ones that no longer exist .DESCRIPTION The purpose of this function is to find SQL Server logins that are used by active directory users that are either disa...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaNetworkActivity.ps1
Get-DbaNetworkActivity.ps1
Function Get-DbaNetworkActivity { <# .SYNOPSIS Gets the Current traffic on every Network Interface on a computer. .DESCRIPTION Gets the Current traffic on every Network Interface on a computer. See https://msdn.microsoft.com/en-us/library/aa394293(v=vs.85).aspx Requires...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaTempdbUsage.ps1
Get-DbaTempdbUsage.ps1
Function Get-DbaTempdbUsage { <# .SYNOPSIS Gets Tempdb usage for running queries. .DESCRIPTION This function queries DMVs for running sessions using Tempdb and returns results if those sessions have user or internal space allocated or deallocated against them. .PARAMETER SqlInstance ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Install-DbaWatchUpdate.ps1
Install-DbaWatchUpdate.ps1
Function Install-DbaWatchUpdate { <# .SYNOPSIS Adds the scheduled task to support Watch-DbaUpdate .DESCRIPTION Adds the scheduled task to support Watch-DbaUpdate. .NOTES Tags: JustForFun dbatools PowerShell module (https://dbatools.io, clemaire@gmail.com) Copyright (C) 2016 Chrissy LeMaire This prog...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaDatabaseCollation.ps1
Test-DbaDatabaseCollation.ps1
Function Test-DbaDatabaseCollation { <# .SYNOPSIS Compares Database Collations to Server Collation .DESCRIPTION Compares Database Collations to Server Collation .PARAMETER SqlServer The SQL Server that you're connecting to. .PARAMETER Credential Credential object used to connect to the SQL Server as a...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaQueryStoreConfig.ps1
Set-DbaQueryStoreConfig.ps1
Function Set-DbaQueryStoreConfig { <# .SYNOPSIS Configure Query Store settings for a specific or multiple databases. .DESCRIPTION Configure Query Store settings for a specific or multiple databases. .PARAMETER SqlInstance The SQL Server that you're connecting to. .PARAMETER SqlCredential SqlCredential...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaConnectionAuthScheme.ps1
Test-DbaConnectionAuthScheme.ps1
Function Test-DbaConnectionAuthScheme { <# .SYNOPSIS Returns the transport protocol and authentication scheme of the connection. This is useful to determine if your connection is using Kerberos. .DESCRIPTION By default, this command will return the ConnectName, ServerName, Transport and AuthScheme of the curre...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Remove-DbaCmConnection.ps1
Remove-DbaCmConnection.ps1
function Remove-DbaCmConnection { <# .SYNOPSIS Removes connection objects from the connection cache used for remote computer management. .DESCRIPTION Removes connection objects from the connection cache used for remote computer management. ....
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaRoleMember.ps1
Get-DbaRoleMember.ps1
Function Get-DbaRoleMember { <# .SYNOPSIS Get members of all roles on a Sql instance. .DESCRIPTION Get members of all roles on a Sql instance. Default output includes columns SQLServer, Database, Role, Member. .PARAMETER SQLInstance The SQL Server that you're connecting to. .PARAMETER SqlCredential A...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaCmConnection.ps1
Get-DbaCmConnection.ps1
function Get-DbaCmConnection { <# .SYNOPSIS Retrieves windows management connections from the cache .DESCRIPTION Retrieves windows management connections from the cache .PARAMETER ComputerName The computername to ComputerName fo...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/CsvSqlimport.ps1
CsvSqlimport.ps1
Function Import-CsvToSql { <# .SYNOPSIS Efficiently imports very large (and small) CSV files into SQL Server using only the .NET Framework and PowerShell. .DESCRIPTION Import-CsvToSql takes advantage of .NET's super fast SqlBulkCopy class to import CSV files into SQL Server at up to 90,000 rows a second. T...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaDiskAlignment.ps1
Test-DbaDiskAlignment.ps1
Function Test-DbaDiskAlignment { <# .SYNOPSIS Verifies that your non-dynamic disks are aligned according to physical constraints. .DESCRIPTION Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server. Specif...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaPageFileSetting.ps1
Get-DbaPageFileSetting.ps1
Function Get-DbaPageFileSetting { <# .SYNOPSIS Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain name and fully qualified domain name (FQDN). .DESCRIPTION WMI class Win32_ComputerSystem tells us if Page File is managed automatically. If TRU...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Restore-DbaDatabase.ps1
Restore-DbaDatabase.ps1
function Restore-DbaDatabase { <# .SYNOPSIS Restores a SQL Server Database from a set of backupfiles .DESCRIPTION Upon bein passed a list of potential backups files this command will scan the files, select those that contain SQL Server backup sets. It will then filter those files down to a set that can perfor...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaDatabaseFile.ps1
Get-DbaDatabaseFile.ps1
Function Get-DbaDatabaseFile { <# .SYNOPSIS Returns detailed information about database files. .DESCRIPTION Returns detailed information about database files. Does not use SMO - SMO causes enumeration and this command avoids that. .PARAMETER SqlInstance The target SQL Server inst...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaLastBackup.ps1
Get-DbaLastBackup.ps1
Function Get-DbaLastBackup { <# .SYNOPSIS Get date/time for last known backups .DESCRIPTION Retrieves and compares the date/time for the last known backups, as well as the creation date/time for the database. Default output includes columns Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, Las...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-DbaDatabaseGrowthEvent.ps1
Find-DbaDatabaseGrowthEvent.ps1
Function Find-DbaDatabaseGrowthEvent { <# .SYNOPSIS Finds any database AutoGrow events in the Default Trace. .DESCRIPTION Finds any database AutoGrow events in the Default Trace. .PARAMETER SqlInstance The SQL Server that you're connecting to. .PARAMETER SqlCredential SqlCredential object used to conn...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaLastBackup.ps1
Test-DbaLastBackup.ps1
Function Test-DbaLastBackup { <# .SYNOPSIS Quickly and easily tests the last set of full backups for a server .DESCRIPTION Restores all or some of the latest backups and performs a DBCC CHECKTABLE 1. Gathers information about the last full backups 2. Restores the backps to the Destination with a new name. If...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaEndpoint.ps1
Get-DbaEndpoint.ps1
FUNCTION Get-DbaEndpoint { <# .SYNOPSIS Gets SQL Endpoint(s) information for each instance(s) of SQL Server. .DESCRIPTION The Get-DbaEndpoint command gets SQL Endpoint(s) information for each instance(s) of SQL Server. .PARAMETER SqlInstance SQL Server name or SMO object representing the SQL Server to con...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaConfigValue.ps1
Get-DbaConfigValue.ps1
function Get-DbaConfigValue { <# .SYNOPSIS Returns the configuration value stored under the specified name. .DESCRIPTION Returns the configuration value stored under the specified name. It requires the full name (<Module>.<Name>) and is usually only called by functions. .PARAMETER Name ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaMaxDop.ps1
Test-DbaMaxDop.ps1
Function Test-DbaMaxDop { <# .SYNOPSIS Displays information relating to SQL Server Max Degree of Paralellism setting. Works on SQL Server 2005-2016. .DESCRIPTION Inspired by Sakthivel Chidambaram's post about SQL Server MAXDOP Calculator (https://blogs.msdn.microsoft.com/sqlsakthi/p/maxdop-calculator-sqlser...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlCentralManagementServer.ps1
Copy-SqlCentralManagementServer.ps1
Function Copy-SqlCentralManagementServer { <# .SYNOPSIS Migrates SQL Server Central Management groups and server instances from one SQL Server to another. .DESCRIPTION Copy-SqlCentralManagementServer copies all groups, subgroups, and server instances from one SQL Server to another. .PARAMETER Source The...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaDatabaseState.ps1
Get-DbaDatabaseState.ps1
Function Get-DbaDatabaseState { <# .SYNOPSIS Gets various options for databases, hereby called "states" .DESCRIPTION Gets some common "states" on databases: - "RW" options : READ_ONLY or READ_WRITE - "Status" options : ONLINE, OFFLINE, EMERGENCY - "Access" options : SINGLE_USER, RESTRICTED_USER, MULTI_USE...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaCustomError.ps1
Get-DbaCustomError.ps1
FUNCTION Get-DbaCustomError { <# .SYNOPSIS Gets SQL Custom Error Message information for each instance(s) of SQL Server. .DESCRIPTION The Get-DbaCustomError command gets SQL Custom Error Message information for each instance(s) of SQL Server. .PARAMETER SqlInstance SQL Server name or SMO object representi...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlCustomError.ps1
Copy-SqlCustomError.ps1
Function Copy-SqlCustomError { <# .SYNOPSIS Copy-SqlCustomError migrates custom errors (user defined messages) from one SQL Server to another. .DESCRIPTION By default, all custom errors are copied. The -CustomErrors parameter is autopopulated for command-line completion and can be used to copy only specific ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaDiskAllocation.ps1
Test-DbaDiskAllocation.ps1
Function Test-DbaDiskAllocation { <# .SYNOPSIS Checks all disks on a computer to see if they are formatted to 64k. .DESCRIPTION Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server. Specify -Detailed for details. References: https://techne...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Invoke-DbaDiagnosticQuery.ps1
Invoke-DbaDiagnosticQuery.ps1
function Invoke-DbaDiagnosticQuery { <# .SYNOPSIS Invoke-DbaDiagnosticQuery runs the scripts provided by Glenn Berry's DMV scripts on specified servers. .DESCRIPTION This is the main function of the Sql Server Diagnostic Queries related functions in dbatools. The diagnostic queries are developed and maintaine...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaAgentSchedule.ps1
Set-DbaAgentSchedule.ps1
function Set-DbaAgentSchedule { <# .SYNOPSIS Set-DbaAgentSchedule updates a schedule in the msdb database. .DESCRIPTION Set-DbaAgentSchedule will help update a schedule for a job. It does not attach the schedule to a job. .PARAMETER SqlInstance SQL Server instance. You must have sysadmin access and serv...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaMemoryUsage.ps1
Get-DbaMemoryUsage.ps1
Function Get-DbaMemoryUsage { <# .SYNOPSIS Get amount of memory in use by *all* SQL Server components and instances .DESCRIPTION Retrieves the amount of memory per performance counter. Default output includes columns Server, counter instance, counter, number of pages, memory in KB, memory in MB SSAS and SSIS a...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-DbaUserObject.ps1
Find-DbaUserObject.ps1
Function Find-DbaUserObject { <# .SYNOPSIS Searches SQL Server to find user-owned objects (ie. not dbo or sa) or for any object owned by a specific user specified by the Pattern parameter. .DESCRIPTION Looks at the below list of objects to see if they are either owned by a user or a specific user (using the par...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-SqlConnection.ps1
Test-SqlConnection.ps1
Function Test-SqlConnection { <# .SYNOPSIS Exported function. Tests a the connection to a single instance and shows the output. .DESCRIPTION Tests a the connection to a single instance and shows the output. .PARAMETER SqlServer The SQL Server Instance to test connection against .PARAMETER SqlCredential...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaMaxMemory.ps1
Test-DbaMaxMemory.ps1
Function Test-DbaMaxMemory { <# .SYNOPSIS Calculates the recommended value for SQL Server 'Max Server Memory' configuration setting. Works on SQL Server 2000-2014. .DESCRIPTION Inspired by Jonathan Kehayias's post about SQL Server Max memory (http://bit.ly/sqlmemcalc), this script displays a SQL Server's: ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Update-dbatools.ps1
Update-dbatools.ps1
Function Update-dbatools { <# .SYNOPSIS Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy. .DESCRIPTION Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy. .NOTES dbatools PowerShell module (https://dbatools.io, clemaire@g...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Export-SqlLogin.ps1
Export-SqlLogin.ps1
Function Export-SqlLogin { <# .SYNOPSIS Exports Windows and SQL Logins to a T-SQL file. Export includes login, SID, password, default database, default language, server permissions, server roles, db permissions, db roles. .DESCRIPTION Exports Windows and SQL Logins to a T-SQL file. Export includes login, SID, pa...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlBackupDevice.ps1
Copy-SqlBackupDevice.ps1
Function Copy-SqlBackupDevice { <# .SYNOPSIS Copies backup devices one by one. Copies both SQL code and the backup file itself. .DESCRIPTION Backups are migrated using Admin shares. If destination directory does not exist, SQL Server's default backup directory will be used. If backup device with same name e...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaJobOwner.ps1
Test-DbaJobOwner.ps1
function Test-DbaJobOwner { <# .SYNOPSIS Checks SQL Agent Job owners against a login to validate which jobs do not match that owner. .DESCRIPTION This function will check all SQL Agent Job on an instance against a SQL login to validate if that login owns those SQL Agent Jobs or not. By default, the function wi...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Export-DbaAvailabilityGroup.ps1
Export-DbaAvailabilityGroup.ps1
function Export-DbaAvailabilityGroup { <# .SYNOPSIS Exports SQL Server Availability Groups to a T-SQL file. .DESCRIPTION Exports SQL Server Availability Groups creation scripts to a T-SQL file. This is a function that is not available in SSMS. .PARAMETER SqlServer The SQL Server instance name. SQL Server 2...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Out-DbaDataTable.ps1
Out-DbaDataTable.ps1
Function Out-DbaDataTable { <# .SYNOPSIS Creates a DataTable for an object .DESCRIPTION Creates a DataTable based on an objects properties. This allows you to easily write to SQL Server tables. Thanks to Chad Miller, this is based on his script. https://gallery.technet.microsoft.com/scriptcenter/4208a15...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/New-DbaAgentJob.ps1
New-DbaAgentJob.ps1
function New-DbaAgentJob { <# .SYNOPSIS New-DbaAgentJob creates a new job .DESCRIPTION New-DbaAgentJob makes is possible to create a job in the SQL Server Agent. It returns an array of the job(s) created .PARAMETER SqlInstance SQL Server instance. You must have sysadmin access and server version must...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaQueryExecutionTime.ps1
Get-DbaQueryExecutionTime.ps1
Function Get-DbaQueryExecutionTime { <# .SYNOPSIS Displays Stored Procedures and Ad hoc queries with the highest execution times. Works on SQL Server 2008 and above. .DESCRIPTION Quickly find slow query executions within a database. Results will include stored procedures and individual SQL statements. ....
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaBackupHistory.ps1
Get-DbaBackupHistory.ps1
#ValidationTags#Messaging,FlowControl,Pipeline# Function Get-DbaBackupHistory { <# .SYNOPSIS Returns backup history details for databases on a SQL Server .DESCRIPTION Returns backup history details for some or all databases on a SQL Server. You can even get detai...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaBackupDevice.ps1
Get-DbaBackupDevice.ps1
FUNCTION Get-DbaBackupDevice { <# .SYNOPSIS Gets SQL Backup Device information for each instance(s) of SQL Server. .DESCRIPTION The Get-DbaBackupDevice command gets SQL Backup Device information for each instance(s) of SQL Server. .PARAMETER SqlInstance SQL Server name or SMO object representing the SQL S...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Remove-DbaDatabaseSnapshot.ps1
Remove-DbaDatabaseSnapshot.ps1
Function Remove-DbaDatabaseSnapshot { <# .SYNOPSIS Removes database snapshots .DESCRIPTION Removes (drops) database snapshots from the server .PARAMETER SqlInstance The SQL Server that you're connecting to .PARAMETER Credential Credential object used to connect to the SQL Server as a different user ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Watch-DbaUpdate.ps1
Watch-DbaUpdate.ps1
Function Watch-DbaUpdate { <# .SYNOPSIS Just for fun - checks the PowerShell Gallery every 1 hour for updates to dbatools. Notifies once max per release. .DESCRIPTION Just for fun - checks the PowerShell Gallery every 1 hour for updates to dbatools. Notifies once max per release. Anyone know how to make ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaRunningJob.ps1
Get-DbaRunningJob.ps1
FUNCTION Get-DbaRunningJob { <# .SYNOPSIS Returns all non idle agent jobs running on the server. .DESCRIPTION This function returns agent jobs that active on the SQL Server intance when calling the command. The information is gathered the SMO JobServer.jobs and be returned either in detailed or standard format ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-SqlUnusedIndex.ps1
Find-SqlUnusedIndex.ps1
Function Find-SqlUnusedIndex { <# .SYNOPSIS Find Unused indexes .DESCRIPTION This command will help you to find Unused indexes on a database or a list of databases Also tells how much space you can save by dropping the index. We show the type of compression so you can make a more considered decision. For n...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaDetachedDatabaseInfo.ps1
Get-DbaDetachedDatabaseInfo.ps1
Function Get-DbaDetachedDatabaseInfo { <# .SYNOPSIS Get detailed information about detached SQL Server database files. .DESCRIPTION This script gathers the following information from detached database files: database name, SQL Server version (compatibility level), collation, and file structure. "Data f...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/New-DbaAgentSchedule.ps1
New-DbaAgentSchedule.ps1
function New-DbaAgentSchedule { <# .SYNOPSIS New-DbaAgentSchedule creates a new schedule in the msdb database. .DESCRIPTION New-DbaAgentSchedule will help create a new schedule for a job. It does not attach the schedule to a job. .PARAMETER SqlInstance SQL Server instance. You must have sysadmin access ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlResourceGovernor.ps1
Copy-SqlResourceGovernor.ps1
Function Copy-SqlResourceGovernor { <# .SYNOPSIS Migrates Resource Pools .DESCRIPTION By default, all non-system resource pools are migrated. If the pool already exists on the destination, it will be skipped unless -Force is used. The -ResourcePools parameter is autopopulated for command-line completion an...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-DbaDatabase.ps1
Find-DbaDatabase.ps1
Function Find-DbaDatabase { <# .SYNOPSIS Find database/s on multiple servers that match critea you input .DESCRIPTION Allows you to search SQL Server instances for database that have either the same name, owner or service broker guid. There a several reasons for the service broker guid not matching on a rest...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaUptime.ps1
Get-DbaUptime.ps1
function Get-DbaUptime { <# .SYNOPSIS Returns the uptime of the SQL Server instance, and if required the hosting windows server .DESCRIPTION By default, this command returns for each SQL Server instance passed in: SQL Instance last startup time, Uptime as a PS TimeSpan, Uptime as a formatted string Hosting W...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaTcpPort.ps1
Set-DbaTcpPort.ps1
Function Set-DbaTcpPort { <# .SYNOPSIS Changes the TCP port used by the specified SQL Server. .DESCRIPTION This function changes the TCP port used by the specified SQL Server. .PARAMETER SqlServer The SQL Server that you're connecting to. .PARAMETER Credential Credential object used to connect to th...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaDatabaseOwner.ps1
Set-DbaDatabaseOwner.ps1
function Set-DbaDatabaseOwner { <# .SYNOPSIS Sets database owners with a desired login if databases do not match that owner. .DESCRIPTION This function will alter database ownershipt to match a specified login if their current owner does not match the target login. By default, the target login will be 'sa', but...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlEndpoint.ps1
Copy-SqlEndpoint.ps1
Function Copy-SqlEndpoint { <# .SYNOPSIS Copy-SqlEndpoint migrates server endpoints from one SQL Server to another. .DESCRIPTION By default, all endpoints are copied. The -Endpoints parameter is autopopulated for command-line completion and can be used to copy only specific endpoints. If the endpoint alrea...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaProcess.ps1
Get-DbaProcess.ps1
Function Get-DbaProcess { <# .SYNOPSIS This command displays SQL Server processes. .DESCRIPTION This command displays processes associated with a spid, login, host, program or database. .PARAMETER SqlServer The SQL Server instance. .PARAMETER SqlCredential Allows you to login to servers using SQL Logins...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Find-DbaAgentJob.ps1
Find-DbaAgentJob.ps1
FUNCTION Find-DbaAgentJob { <# .SYNOPSIS Find-DbaAgentJob finds agent job/s that fit certain search filters. .DESCRIPTION This command filters SQL Agent jobs giving the DBA a list of jobs that may need attention or could possibly be options for removal. .PARAMETER SqlInstance The SQL Server instance. You m...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaJobOwner.ps1
Set-DbaJobOwner.ps1
function Set-DbaJobOwner { <# .SYNOPSIS Sets SQL Agent job owners with a desired login if jobs do not match that owner. .DESCRIPTION This function will alter SQL Agent Job ownership to match a specified login if their current owner does not match the target login. By default, the target login will be 'sa', bu...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Remove-DbaDatabase.ps1
Remove-DbaDatabase.ps1
Function Remove-DbaDatabase { <# .SYNOPSIS Drops a database, hopefully even the really stuck ones. .DESCRIPTION Tries a bunch of different ways to remove a database or two or more. .PARAMETER SqlInstance The SQL Server instance holding the databases to be removed.You must have sysadmin access and server ver...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlDatabaseAssembly.ps1
Copy-SqlDatabaseAssembly.ps1
Function Copy-SqlDatabaseAssembly { <# .SYNOPSIS Copy-SqlDatabaseAssembly migrates assemblies from one SQL Server to another. .DESCRIPTION By default, all assemblies are copied. The -Assemblies parameter is autopopulated for command-line completion and can be used to copy only specific assemblies. If the a...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaDatabaseEncryption.ps1
Get-DbaDatabaseEncryption.ps1
function Get-DbaDatabaseEncryption { <# .SYNOPSIS Returns a summary of encrption used on databases based to it. .DESCRIPTION Shows if a database has Transparaent Data encrption, any certificates, asymmetric keys or symmetric keys with details for each. .PARAMETER SqlInstance SQLServer name or SMO object rep...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaMaxMemory.ps1
Set-DbaMaxMemory.ps1
Function Set-DbaMaxMemory { <# .SYNOPSIS Sets SQL Server 'Max Server Memory' configuration setting to a new value then displays information this setting. .DESCRIPTION Sets SQL Server max memory then displays information relating to SQL Server Max Memory configurati...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlOperator.ps1
Copy-SqlOperator.ps1
Function Copy-SqlOperator { <# .SYNOPSIS Copy-SqlOperator migrates operators from one SQL Server to another. .DESCRIPTION By default, all operators are copied. The -Operators parameter is autopopulated for command-line completion and can be used to copy only specific operators. If the associated credential...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaAgentJobStep.ps1
Set-DbaAgentJobStep.ps1
function Set-DbaAgentJobStep { <# .SYNOPSIS Set-DbaAgentJobStep updates a job step. .DESCRIPTION Set-DbaAgentJobStep updates a job step in the SQL Server Agent with parameters supplied. .PARAMETER SqlInstance SQL Server instance. You must have sysadmin access and server version must be SQL Server versio...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-SqlTempDBConfiguration.ps1
Set-SqlTempDBConfiguration.ps1
function Set-SqlTempDbConfiguration { <# .SYNOPSIS Sets tempdb data and log files according to best practices. .DESCRIPTION Function to calculate tempdb size and file configurations based on passed parameters, calculated values, and Microsoft best practices. User must declare SQL Server to be configured and tot...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaAgentJob.ps1
Set-DbaAgentJob.ps1
function Set-DbaAgentJob { <# .SYNOPSIS Set-DbaAgentJob updates a job. .DESCRIPTION Set-DbaAgentJob updates a job in the SQL Server Agent with parameters supplied. .PARAMETER SqlInstance SQL Server instance. You must have sysadmin access and server version must be SQL Server version 2000 or greater. ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Test-DbaDatabaseCompatibility.ps1
Test-DbaDatabaseCompatibility.ps1
Function Test-DbaDatabaseCompatibility { <# .SYNOPSIS Compares Database Compatibility level to Server Compatibility .DESCRIPTION Compares Database Compatibility level to Server Compatibility .PARAMETER SqlServer The SQL Server that you're connecting to. .PARAMETER Credential Credential object used to ...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaDatabaseState.ps1
Set-DbaDatabaseState.ps1
Function Set-DbaDatabaseState { <# .SYNOPSIS Sets various options for databases, hereby called "states" .DESCRIPTION Sets some common "states" on databases: - "RW" options (ReadOnly, ReadWrite) - "Status" options (Online, Offline, Emergency, plus a special "Detached") - "Access" options (SingleUser, Restr...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Connect-DbaSqlServer.ps1
Connect-DbaSqlServer.ps1
Function Connect-DbaSqlServer { <# .SYNOPSIS Creates an efficient SMO SQL Server object. .DESCRIPTION This command is efficient because it initializes properties that do not cause enumeration by default. It also supports both Windows and SQL Server credentials and detects which alternative credentials. By d...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Get-DbaQueryStoreConfig.ps1
Get-DbaQueryStoreConfig.ps1
Function Get-DbaQueryStoreConfig { <# .SYNOPSIS Get the Query Store configuration for Query Store enabled databases. .DESCRIPTION Retrieves and returns the Query Store configuration for every database that has the Query Store feature enabled. .PARAMETER SqlInstance The SQL Server that you're connecting to...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Set-DbaSpn.ps1
Set-DbaSpn.ps1
#ValidationTags#FlowControl,Pipeline# Function Set-DbaSpn { <# .SYNOPSIS Sets an SPN for a given service account in active directory (and also enables delegation to the same SPN by default) .DESCRIPTION This function will connect to Active Directory and search for an account. If the account is found, it will a...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Copy-SqlDataCollector.ps1
Copy-SqlDataCollector.ps1
Function Copy-SqlDataCollector { <# .SYNOPSIS Migrates user SQL Data Collector collection sets. SQL Data Collector configuration is on the agenda, but it's hard. .DESCRIPTION By default, all data collector objects are migrated. If the object already exists on the destination, it will be skipped unless -Force is...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Save-DbaDiagnosticQueryScript.ps1
Save-DbaDiagnosticQueryScript.ps1
function Save-DbaDiagnosticQueryScript { <# .SYNOPSIS Save-DbaDiagnosticQueryScript downloads the most recent version of all Glenn Berry DMV scripts .DESCRIPTION The dbatools module will have the diagnostice queries pre-installed. Use this only to update to a more recent version or specific versions. This fu...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Invoke-DbaWhoisActive.ps1
Invoke-DbaWhoisActive.ps1
Function Invoke-DbaWhoisActive { <# .SYNOPSIS Outputs results of Adam Machanic's sp_WhoIsActive DataTable .DESCRIPTION Output results of Adam Machanic's sp_WhoIsActive This command was built with Adam's permission. To read more about sp_WhoIsActive, please visit: Updates: http://sqlblog.com/blogs/adam_mac...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/functions/Read-DbaBackupHeader.ps1
Read-DbaBackupHeader.ps1
Function Read-DbaBackupHeader { <# .SYNOPSIS Reads and displays detailed information about a SQL Server backup .DESCRIPTION Reads full, differential and transaction log backups. An online SQL Server is required to parse the backup files and the path specified must be relative to that SQL Server. .PARAMETER...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/bin/library.ps1
library.ps1
#region Test whether the module had already been imported if (([System.Management.Automation.PSTypeName]'SqlCollective.Dbatools.Configuration.Config').Type) { # No need to load the library again, if the module was once already imported. $ImportLibrary = $false } else { $ImportLibrary = $true } #...
PowerShellCorpus/PowerShellGallery/dbatools/0.8.957/bin/typealiases.ps1
typealiases.ps1
try { [psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::add("DbaCmConnectionParameter", "Sqlcollective.Dbatools.Parameter.DbaCmConnectionParameter") } catch { } try { [psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::add("DbaInstanceParameter", "Sqlcollective....
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Set-UpdateConfig.ps1
Set-UpdateConfig.ps1
function Set-UpdateConfig { <# .Synopsis Set the Windows Image Tools Update Config used for creating the temp VM .DESCRIPTION Set the config used by Invoke-WitUpdate to build a VM and update Windows Images .EXAMPLE Set-WitUpdateConfig -...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Update-WindowsImageWMF.ps1
Update-WindowsImageWMF.ps1
function Update-WindowsImageWMF { <# .Synopsis Updates WMF to 4.0, 5.0 Production Preview or 5.0 (and .NET to 4.6) in a Windows Update Image .DESCRIPTION This Command downloads WMF 4.0, 5.0PP or 5.0 (Production Preview) and .NET 4.6 offline installer ...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/HelperFunctions.ps1
HelperFunctions.ps1
function Get-FullFilePath { <# .Synopsis Get Absolute path from relative path .DESCRIPTION Takes a relative path like .\file.txt and returns the full path. Parent folder must exist, but target file does not. The target file does not hav...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/New-WindowsImageToolsExample.ps1
New-WindowsImageToolsExample.ps1
function New-WindowsImageToolsExample { <# .Synopsis Create folders and script examples on the use of Windows Image Tools .DESCRIPTION This Command creates the folders structures and example files needed to use Windows Image Tools to auto update windows images. ...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Set-VHDPartition.ps1
Set-VHDPartition.ps1
function Set-VHDPartition { <# .Synopsis Sets the content of a VHD(X) using a source WIM or ISO .DESCRIPTION This command will copy the content of the SourcePath ISO or WIM and populate the partitions found in the VHD(X) You must supply the path to...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Convert-Wim2VHD.ps1
Convert-Wim2VHD.ps1
function Convert-Wim2VHD { <# .Synopsis Create a VHDX and populate it from a WIM .DESCRIPTION This command will create a VHD or VHDX formated for UEFI (Gen 2/GPT) or BIOS (Gen 1/MBR) You must supply the path to the VHD/VHDX file and a valid WIM/ISO....
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Mount-VhdAndRunBlock.ps1
Mount-VhdAndRunBlock.ps1
function Mount-VhdAndRunBlock { <# .Synopsis Mount a VHD(x), runs a script block and unmounts the VHD(x) driveleter stored in $driveLetter .DESCRIPTION Us this function to read / write files inside a vhd. Any objects emited by the scriptblock are returned by th...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Initialize-VHDPartition.ps1
Initialize-VHDPartition.ps1
function Initialize-VHDPartition { <# .Synopsis Create VHD(X) with partitions needed to be bootable .DESCRIPTION This command will create a VHD or VHDX file. Supported layours are: BIOS, UEFO or WindowsToGo. To create a recovery partitions use -R...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Invoke-WindowsImageUpdate.ps1
Invoke-WindowsImageUpdate.ps1
function Invoke-WindowsImageUpdate { <# .Synopsis Starts the process of applying updates to all (or selected) images in a Windows Image Tools BaseImages Folder .DESCRIPTION This Command updates all (or selected) the images created via Add-UpdateImage in a Window...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Add-UpdateImage.ps1
Add-UpdateImage.ps1
function Add-UpdateImage { <# .Synopsis Add a Windows Image to a Windows Image Tools Update Directory .DESCRIPTION This command will convert a .ISO or .WIM into a VHD populated with an unattend.xml and first boot script .EXAMPLE Add-Wit...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Wim2VhdClass.ps1
Wim2VhdClass.ps1
$code = @" using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Text.RegularExpressio...