source
stringclasses
1 value
repo
stringclasses
33 values
repo_url
stringclasses
33 values
path
stringlengths
7
179
language
stringclasses
1 value
license
stringclasses
4 values
stars
int64
2.27k
53.4k
ref
stringclasses
4 values
size_bytes
int64
48
259k
text
stringlengths
48
259k
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Get-LocalUser/Get-LocalUser.ps1
PowerShell
mit
2,846
master
1,639
function Get-LocalUser { <# .SYNOPSIS This script can be list all of local user account. .DESCRIPTION This script can be list all of local user account. The function is using WMI to connect to the remote machine .PARAMETER ComputerName Specifies the computers on which ...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCSM-Get-SCSMWorkItemChildItem/Get-SCSMWorkItemChildItemRA.ps1
PowerShell
mit
2,846
master
566
# Get the review activity $childWI_ReviewerActivityHasReviewers_Class_id = '6e05d202-38a4-812e-34b8-b11642001a80' $childWI_ReviewerActivityHasReviewers_Class_obj = Get-SCSMRelationshipClass -id $childWI_ReviewerActivityHasReviewers_Class_id # Get the reviewer $childWI_ReviewerisUser_Class_id = '90da7d7c-948b-e16e-f3...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCSM-Get-SCSMWorkItemChildItem/Get-SCSMWorkItemChildItem.ps1
PowerShell
mit
2,846
master
1,657
Function Get-SCSMWorkItemChildItem { <# .SYNOPSIS Retrieve item associated with a work item .DESCRIPTION Retrieve item associated with a work item .PARAMETER WorkItemGUID Specify the GUID of the WorkItem .EXAMPLE Get-SCSMWorkItemChildItem -WorkItemGuid $WIGuid .NO...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Expand-GzipFile/Expand-GzipFile.ps1
PowerShell
mit
2,846
master
2,081
Function Expand-GZipFile { <# .Synopsis Unzip a gz file .Description Unzip a gz file .Notes Change History 1.0 | 2019/03/22 | francois-xavier cat (@lazywinadmin) based on https://social.technet.microsoft.com/Forums/windowsserver/en-US/5aa53fef-5229-4313-a035-8b3a38ab93f5/unzip-gz-files-using...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Test-IsLocalAdministrator/Test-IsLocalAdministrator.ps1
PowerShell
mit
2,846
master
675
function Test-IsLocalAdministrator { <# .SYNOPSIS Function to verify if the current user is a local Administrator on the current system .DESCRIPTION Function to verify if the current user is a local Administrator on the current system .EXAMPLE Test-IsLocalAdministrator True .NOTES Francois-Xavi...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Get-LocalGroup/Get-LocalGroup.ps1
PowerShell
mit
2,846
master
1,542
function Get-LocalGroup { <# .SYNOPSIS This script can be list all of local group account. .DESCRIPTION This script can be list all of local group account. The function is using WMI to connect to the remote machine .PARAMETER ComputerName Specifies the computers on whi...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Get-ScriptAlias/Get-ScriptAlias.ps1
PowerShell
mit
2,846
master
2,787
function Get-ScriptAlias { <# .SYNOPSIS Function to retrieve the aliases inside a Powershell script file. .DESCRIPTION Function to retrieve the aliases inside a Powershell script file. Using PowerShell AST Parser we are able to retrieve the functions and cmdlets used in the script. ...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCCM-Get-SCCMDeviceCollectionDeployment/Get-SCCMDeviceCollectionDeployment.ps1
PowerShell
mit
2,846
master
7,597
function Get-SCCMDeviceCollectionDeployment { <# .SYNOPSIS Function to retrieve a Device targeted application(s) .DESCRIPTION Function to retrieve a Device targeted application(s). The function will first retrieve all the collection where the Device is member of and find dep...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCSM-Get-SCSMServiceRequestComment/Get-SCSMServiceRequestComment.ps1
PowerShell
mit
2,846
master
2,792
function Get-SCSMServiceRequestComment { <# .SYNOPSIS Function to retrieve the comments from a Service Request WorkItem .DESCRIPTION Function to retrieve the comments from a Service Request WorkItem .PARAMETER DateTime Specifies from when (DateTime) the search need to look ...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
AD-SITE-Get_Site_and_Subnets/Get-ADSiteAndSubnet.ps1
PowerShell
mit
2,846
master
2,598
function Get-ADSiteAndSubnet { <# .SYNOPSIS This function will retrieve Site names, subnets names and descriptions. .DESCRIPTION This function will retrieve Site names, subnets names and descriptions. .EXAMPLE Get-ADSiteAndSubnet .EXAMPLE Get-ADSiteAndSubnet | Expo...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCSM-Add-SCSMSRComment/Add-SCSMSRComment.ps1
PowerShell
mit
2,846
master
3,722
Function Add-SCSMSRComment { <# .SYNOPSIS Function to add a comment inside a Service Request .DESCRIPTION Function to add a comment inside a Service Request You need to have SMlets installed and permission to write inside the service request. .PARAMETER ServiceRequestObject Specifies the Servi...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Set-RDPDisable/Set-RDPDisable.ps1
PowerShell
mit
2,846
master
1,578
function Set-RDPDisable { <# .SYNOPSIS The function Set-RDPDisable disable RDP remotely using the registry .DESCRIPTION The function Set-RDPDisable disable RDP remotely using the registry .PARAMETER ComputerName Specifies the ComputerName .EXAMPLE PS C:\> Set-RDPDi...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
TOOL-Remove-PSObjectProperty/Remove-PSObjectProperty.ps1
PowerShell
mit
2,846
master
710
function Remove-PSObjectProperty { <# .SYNOPSIS Function to Remove a specifid property from a PowerShell object .DESCRIPTION Function to Remove a specifid property from a PowerShell object .PARAMETER PSObject Specifies the PowerShell Object .PARAMETER Property Specifies the property to remove .EXAMP...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
EXCHANGE-Connect-ExchangeOnline/Connect-ExchangeOnline.ps1
PowerShell
mit
2,846
master
1,735
function Connect-ExchangeOnline { <# .SYNOPSIS Function to Connect to an Exchange Online .DESCRIPTION Function to Connect to an Exchange Online .PARAMETER ConnectionUri Specifies the Connection Uri to use Default is https://ps.outlook.com/powershell/ .PARAMETER Cre...
github
lazywinadmin/PowerShell
https://github.com/lazywinadmin/PowerShell
SCCM-Set-SCCMClientCacheLocation/Set-SCCMClientCacheLocation.ps1
PowerShell
mit
2,846
master
2,431
function Set-SCCMClientCacheLocation { <# .SYNOPSIS Function to set the cache location on a SCCM Client .DESCRIPTION Function to set the cache location on a SCCM Client .PARAMETER ComputerName Specifies the name of the client on which the Cache location ne...
github
pbatard/Fido
https://github.com/pbatard/Fido
Fido.ps1
PowerShell
gpl-3.0
2,831
master
55,714
# # Fido v1.70 - ISO Downloader, for Microsoft Windows and UEFI Shell # Copyright © 2019-2026 Pete Batard <pete@akeo.ie> # Command line support: Copyright © 2021 flx5 # ConvertTo-ImageSource: Copyright © 2016 Chris Carter # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
dbatools.psm1
PowerShell
mit
2,763
development
44,196
#requires -Version 3.0 param( [Collections.IDictionary] [Alias('Options')] $Option = @{ } ) $script:start = [DateTime]::Now function Write-ImportTime { param ( [string]$Text, $Timestamp = ([DateTime]::now) ) if (-not $script:dbatools_previousImportPerformance) { $script...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
dbatools.psd1
PowerShell
mit
2,763
development
28,777
# # Module manifest for module 'dbatools' # # Generated by: Chrissy LeMaire # # Generated on: 9/8/2015 # @{ # Script module or binary module file associated with this manifest. RootModule = 'dbatools.psm1' # Version number of this module. ModuleVersion = '2.8.1' # ID used to uniquely...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
cleanup.ps1
PowerShell
mit
2,763
development
5,349
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param( $module = "dbatools" ) # Which process should we be looking for? if ($psedition -eq 'Core') { $process = "pwsh" } else { $process = "powershell" } if (($PSVersionTable.PSVersion.Major -le 5) -or ($PSVersionTable.PSVersion.Major -gt 6 -and...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/TabExpansionPlusPlus.ps1
PowerShell
mit
2,763
development
37,405
if (-not $ExecutionContext.SessionState.InvokeCommand.GetCommand('Register-ArgumentCompleter','Function,Cmdlet')) { ############################################################################# # # TabExpansionPlusPlus # # <# Copyright (c) 2013, Jason Shirk All rights reserved. Redistribution...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Expand-Archive.ps1
PowerShell
mit
2,763
development
49,694
if ($PSVersionTable.PSVersion.Major -lt 5) { <# Copied from the Microsoft Module: Microsoft.PowerShell.Archive Which ships with PowerShell Version 5 but will run under v3. #> function Expand-Archive { <# .SYNOPSIS Extracts files from a specified archive (zipped) file...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Unblock-File.ps1
PowerShell
mit
2,763
development
240
if ($isLinux -or $IsMacOs) { # Create a fake unblock-file function Unblock-File { [CmdletBinding()] param( [Parameter(ValueFromPipeline)] [string[]]$Path ) # do nothing } }
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Get-Runspace.ps1
PowerShell
mit
2,763
development
925
if (-not $ExecutionContext.SessionState.InvokeCommand.GetCommand('Get-Runspace','Function,Cmdlet')) { function Get-Runspace { try { $runspaces = [Dataplat.Dbatools.Runspace.RunspaceHost]::Runspaces.Values foreach ($rs in $runspaces) { $availability = switch ($rs.State...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Get-GenericArgumentCompleter.ps1
PowerShell
mit
2,763
development
719
if (-not $ExecutionContext.SessionState.InvokeCommand.GetCommand('Register-ArgumentCompleter','Function,Cmdlet')) { Function Get-GenericArgumentCompleter { param ( [string]$name, [object]$collection ) Register-ArgumentCompleter -ParameterName $name -ScriptBlock { ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Compress-Archive.ps1
PowerShell
mit
2,763
development
55,490
if ($PSVersionTable.PSVersion.Major -lt 5) { <# Copied from the Microsoft Module: Microsoft.PowerShell.Archive Which ships with PowerShell Version 5 but will run under v3. #> function Compress-Archive { <# .SYNOPSIS Creates an archive, or zipped file, from specified f...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
opt/Import-PfxCertificate.ps1
PowerShell
mit
2,763
development
4,167
if ($PSVersionTable.PSVersion.Major -lt 5) { <# PowerShell v3-compatible version of Import-PfxCertificate The native Import-PfxCertificate cmdlet was introduced in PowerShell v5 This implementation provides equivalent functionality for v3+ using .NET Framework APIs #> function Import-PfxCertif...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/testing/Invoke-ManualPester.ps1
PowerShell
mit
2,763
development
14,873
function Invoke-ManualPester { <# .SYNOPSIS Runs dbatools tests with support for both Pester v4 and v5. .DESCRIPTION This is a helper function to automate running tests locally. It supports both Pester v4 and v5 tests, automatically detecting which version to use based on the test file requirements. For Pe...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/testing/Get-TestConfig.ps1
PowerShell
mit
2,763
development
4,069
function Get-TestConfig { param( [string]$LocalConfigPath = "$script:PSModuleRoot/tests/constants.local.ps1" ) $config = [ordered]@{ CommonParameters = [System.Management.Automation.PSCmdlet]::CommonParameters Defaults = [System.Management.Automation.DefaultParameterDictiona...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/maintenance/PSSession-Cleanup.ps1
PowerShell
mit
2,763
development
947
$scriptBlock = { while ([Dataplat.Dbatools.Connection.ConnectionHost]::PSSessionCountExpired -gt 0) { $session = $null $session = [Dataplat.Dbatools.Connection.ConnectionHost]::PSSessionPurgeExpired() if ($null -ne $session) { $session | Remove-PSSession } } } Register-DbaMaintenanceTask...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/maintenance/tempcleanup.ps1
PowerShell
mit
2,763
development
324
$scriptBlock = { if (-not $Env:TEMP) { $Env:TEMP = [System.IO.Path]::GetTempPath() } Get-ChildItem -Path $Env:TEMP -Filter dbatools* | Remove-Item -ErrorAction Ignore -Recurse } Register-DbaMaintenanceTask -Name "tempcleanup" -ScriptBlock $scriptBlock -Once -Delay (New-TimeSpan -Minutes 1) -Priority...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/maintenance/teppInsertTask.ps1
PowerShell
mit
2,763
development
543
$scriptBlock = { $ModuleRoot = [Dataplat.Dbatools.dbaSystem.SystemHost]::ModuleBase foreach ($file in (Get-ChildItem -Path "$ModuleRoot\private\functions\tabcompletion" -File)) { Import-Command -Path $file.FullName } foreach ($file in (Get-ChildItem -Path "$ModuleRoot\private\dynamicparams\" -...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-DbMirrorValidation.ps1
PowerShell
mit
2,763
development
9,313
function Invoke-DbMirrorValidation { <# .SYNOPSIS Validates if a mirror is ready .DESCRIPTION Validates if a mirror is ready Thanks to https://github.com/mmessano/PowerShell/blob/master/SQL-ConfigureDatabaseMirroring.ps1 .PARAMETER Primary S...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-ComputerTarget.ps1
PowerShell
mit
2,763
development
1,360
function Test-ComputerTarget { <# .SYNOPSIS Validates whether the input string can be legally used to target a computer. .DESCRIPTION Validates whether the input string can be legally used to target a computer. It will consider: - Names (NETBIOS/dns) - IPv4 Addresses...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-DbaADObject.ps1
PowerShell
mit
2,763
development
9,828
function Get-DbaADObject { <# .SYNOPSIS Get-DbaADObject tries to facilitate searching AD with dbatools, which ATM can't require AD cmdlets. .DESCRIPTION As working with multiple domains, forests, ldap filters, partitions, etc is quite hard to grasp, let's try to do "the right thing" here and fa...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ExportFilePath.ps1
PowerShell
mit
2,763
development
1,913
#$FilePath = Get-ExportFilePath -Path $PSBoundParameters.Path -FilePath $PSBoundParameters.FilePath -Type sql -ServerName $instance function Get-ExportFilePath ($Path, $FilePath, $Type, $ServerName, $DatabaseName, [switch]$Unique) { if ($FilePath) { return ($ExecutionContext.SessionState.Path.GetUnresolvedP...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-Alter.ps1
PowerShell
mit
2,763
development
390
function Invoke-Alter { <# For stubborn .net objects that won't throw properly #> [CmdletBinding(SupportsShouldProcess)] param ( [object]$Object ) process { if ($Pscmdlet.ShouldProcess($Name, "Performing create")) { $ErrorActionPreference = 'Stop' ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-RestoreContinuableDatabase.ps1
PowerShell
mit
2,763
development
1,581
function Get-RestoreContinuableDatabase { <# .SYNOPSIS Gets a list of databases from a SQL instance that are in a state for further restores .DESCRIPTION Takes a SQL instance and checks for databases with a redo_start_lsn value, and returns the database name and that value -gt SQl 2005 it comes...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Update-SqlPermission.ps1
PowerShell
mit
2,763
development
20,737
function Update-SqlPermission { <# .SYNOPSIS Internal function. Updates permission sets, roles, database mappings on server and databases .PARAMETER SourceServer Source Server .PARAMETER SourceLogin Source login .PARAMETER DestServer De...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-DbaMaskingValue.ps1
PowerShell
mit
2,763
development
7,781
function Convert-DbaMaskingValue { <# .SYNOPSIS Convert a value to a TSQL format that be used in queries .DESCRIPTION The command will take a value and with the data type return it in a format that can be used in queries. For instance, a value "this is text" with data type...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ADSConnection.ps1
PowerShell
mit
2,763
development
8,003
# got this from here # https://vimalshekar.github.io/scriptsamples/Getting-Stored-Windows-Credentials-using-PowerShell Function Get-ADSConnection { # Defining C# code to enum credman creds $CredEnumWrapperClass = @' using System; using System.Runtime.InteropServices; namespace CredEnum { public enu...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-SqlAgent.ps1
PowerShell
mit
2,763
development
655
function Test-SqlAgent { <# .SYNOPSIS Internal function. Checks to see if SQL Server Agent is running on a server. #> [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [object]$SqlInstance, [PSCredential]$SqlCredential ) if (...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-ConnectionString.ps1
PowerShell
mit
2,763
development
1,111
function Convert-ConnectionString { <# # there are new synonyms in Microsoft.Data # https://docs.microsoft.com/en-us/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace?view=sql-server-ver15#new-connection-string-property-synonyms #> [CmdletBinding()] param( [Parameter(...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/New-DbaLogShippingSecondaryDatabase.ps1
PowerShell
mit
2,763
development
14,529
function New-DbaLogShippingSecondaryDatabase { <# .SYNOPSIS New-DbaLogShippingSecondaryDatabase sets up a secondary databases for log shipping. .DESCRIPTION New-DbaLogShippingSecondaryDatabase sets up a secondary databases for log shipping. This is executed on th...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-BackupAncientHistory.ps1
PowerShell
mit
2,763
development
8,805
function Get-BackupAncientHistory { <# .SYNOPSIS Returns details of the last full backup of a SQL Server 2000 database .DESCRIPTION Backup History command to pull limited history from a SQL 2000 instance. If not using SQL 2000, please use Get-DbaDbBackupHistory which pulls m...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ResourceState.ps1
PowerShell
mit
2,763
development
310
function Get-ResourceState ($state) { switch ($state) { -1 { "Unknown" } 0 { "Inherited" } 1 { "Initializing" } 2 { "Online" } 3 { "Offline" } 4 { "Failed" } 128 { "Pending" } 129 { "Online Pending" } 130 { "Offline Pending" } } }
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-PendingReboot.ps1
PowerShell
mit
2,763
development
2,628
function Test-PendingReboot { <# .SYNOPSIS Based on https://github.com/adbertram/PSSqlUpdater This function tests various registry values to see if the local computer is pending a reboot .NOTES Inspiration from: https://gallery.technet.microsoft.com/scriptcenter/G...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ObjectNameParts.ps1
PowerShell
mit
2,763
development
4,352
function Get-ObjectNameParts { <# .SYNOPSIS Parse a one, two, or three part object name into seperate paths .DESCRIPTION Takes a one, two or three part object name and splits them into Database, Schema and Name .PARAMETER ObjectName The object name to parse. You can specify a o...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-ExportDirectory.ps1
PowerShell
mit
2,763
development
349
Function Test-ExportDirectory ($Path) { if (-not (Test-Path -Path $Path)) { $null = New-Item -ItemType Directory -Path $Path -Force } else { if ((Get-Item $Path -ErrorAction Ignore) -isnot [System.IO.DirectoryInfo]) { Stop-Function -Message "Path ($Path) must be a directory" ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Select-DefaultView.ps1
PowerShell
mit
2,763
development
2,551
function Select-DefaultView { <# This command enables us to send full on objects to the pipeline without the user seeing it See it in action in Get-DbaDbSnapshot and Remove-DbaDbSnapshot a lot of this is from boe, thanks boe! https://learn-powershell.net/2013/08/03/quick-hits-set-the-default-prop...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Add-TeppCacheItem.ps1
PowerShell
mit
2,763
development
2,015
function Add-TeppCacheItem { <# .SYNOPSIS Internal function to add an item to the TEPP cache. .DESCRIPTION Internal function to add an item to the TEPP cache. .PARAMETER SqlInstance The SQL Server instance. .PARAMETER Type The type of object. Must be part of "[Data...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-DbaReportingService.ps1
PowerShell
mit
2,763
development
9,650
function Get-DbaReportingService { <# .SYNOPSIS Gets the SQL Server Reporting Services on a computer. .DESCRIPTION Gets the SQL Server Reporting Services on one or more computers. Requires Local Admin rights on destination computer(s). .PARAMETER ComputerName The targe...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Where-DbaObject.ps1
PowerShell
mit
2,763
development
4,432
function global:Where-DbaObject { <# .SYNOPSIS A slightly more efficient filter function than Where-Object. .DESCRIPTION A slightly more efficient filter function than Where-Object. In case multiple filters are set, any one hit will work. .PARAMETER Inpu...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-SqlFileStructure.ps1
PowerShell
mit
2,763
development
4,967
function Get-SqlFileStructure { <# .SYNOPSIS Internal function. Returns custom object that contains file structures on destination paths (\\SqlInstance\m$\mssql\etc\etc\file.mdf) for source and destination servers. #> [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ErrorMessage.ps1
PowerShell
mit
2,763
development
891
function Get-ErrorMessage { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [System.Management.Automation.ErrorRecord]$Record ) process { $innermessage = $Record.Exception.InnerException.InnerException.InnerException.InnerException.InnerException.Message ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-RegServerGroupReverseParse.ps1
PowerShell
mit
2,763
development
395
function Get-RegServerGroupReverseParse ($object) { if ($object.Name -eq 'DatabaseEngineServerGroup') { $object.Name } else { $name = @() do { $name += $object.Name.Split("\")[0] $object = $object.Parent } until ($object.Name -eq 'DatabaseEngineSer...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Find-SqlInstanceSetup.ps1
PowerShell
mit
2,763
development
3,040
function Find-SqlInstanceSetup { <# .SYNOPSIS Returns a SQL Server setup.exe filesystem object based on parameters .DESCRIPTION Recursively searches specified folder for a setup.exe file that has the following .VersionInfo: - FileDescription in : *...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-ConnectionParent.ps1
PowerShell
mit
2,763
development
969
function Get-ConnectionParent { [cmdletbinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [object]$InputObject, [switch]$Database ) process { if ($Database) { $parentcount = 0 do { if ($null -ne $InputObject.Parent) { ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-DbVersionToSqlVersion.ps1
PowerShell
mit
2,763
development
1,005
function Convert-DbVersionToSqlVersion { <# .SYNOPSIS Internal function that makes db versions human readable .DESCRIPTION Internal function that makes db versions human readable .PARAMETER dbversion Analysis Server .EXAMPLE Convert-DbVersionToSqlVersion -dbversion 856 Returns "SQL Server vNext CTP1" #> ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-SqlSaLogin.ps1
PowerShell
mit
2,763
development
669
function Get-SqlSaLogin { <# .SYNOPSIS Internal function. Gets the name of the sa login in case someone changed it. .PARAMETER SqlInstance The SQL Server instance. .PARAMETER SqlCredential Allows you to login to servers using SQL Logins instead of Windows ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-SqlCmdVars.ps1
PowerShell
mit
2,763
development
4,050
function Get-SqlCmdVars { <# .SYNOPSIS Retrieves the values of PowerShell parameters and updates values of SqlmdVars listed in the publish.xml. .DESCRIPTION Attempt to resolve SQLCmd variables via matching powershell variables explicitly defined in the current context. ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-HostOSLinux.ps1
PowerShell
mit
2,763
development
278
function Test-HostOSLinux { param ( [object]$SqlInstance, [object]$SqlCredential ) $server = Connect-DbaInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential $server.ConnectionContext.ExecuteScalar("SELECT @@VERSION") -match "Linux" }
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-SqlSa.ps1
PowerShell
mit
2,763
development
696
function Test-SqlSa { <# .SYNOPSIS Internal function. Ensures sysadmin account access on SQL Server. #> [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [object]$SqlInstance, [PSCredential]$SqlCredential ) try { if ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-WmiHadr.ps1
PowerShell
mit
2,763
development
1,263
function Get-WmiHadr { [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] [DbaInstanceParameter[]]$SqlInstance, [PSCredential]$Credential, [switch]$EnableException ) process { foreach ($instance in $SqlInstance) { try { ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-DirectoryRestoreFile.ps1
PowerShell
mit
2,763
development
1,443
function Get-DirectoryRestoreFile { <# .SYNOPSIS Internal Function to get SQL Server backfiles from a specified folder .DESCRIPTION Takes path, checks for validity. Scans for usual backup file #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] [string]$Path, ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Resolve-DbaComputerName.ps1
PowerShell
mit
2,763
development
2,116
function Resolve-DbaComputerName { <# .SYNOPSIS Resolves the computer based on the ComputerName of the input DbaInstanceParameter. .DESCRIPTION Resolves the computer based on the ComputerName of the input DbaInstanceParameter. Designed to get the FullComputerName needed for Invoke-Co...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-HexStringToByte.ps1
PowerShell
mit
2,763
development
1,161
function Convert-HexStringToByte { <# .SYNOPSIS Converts hex string into byte object .DESCRIPTION Converts hex string (e.g. '0x01641736') into the byte object ([byte[]]@(1,100,23,54)) Used when working with SMO logins and their byte parameters: sids and hashed passwords .PARAMETER InputObj...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-DbaServiceErrorMessage.ps1
PowerShell
mit
2,763
development
2,220
function Get-DbaServiceErrorMessage { <# .SYNOPSIS Internal function. Returns the list of error code messages for Windows service management. #> param( [parameter(ValueFromPipeline, Position = 1)] [int]$ErrorNumber ) $returnCodes = @("The request was accepted.", "The...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Update-ServiceStatus.ps1
PowerShell
mit
2,763
development
16,295
function Update-ServiceStatus { <# .SYNOPSIS Internal function. Sends start/stop request to a SQL Server service and wait for the result. .DESCRIPTION Accepts objects from Get-DbaService and performs a corresponding action. .PARAMETER Credential Credential object used to connec...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-CommandWithFallback.ps1
PowerShell
mit
2,763
development
3,015
function Invoke-CommandWithFallback { <# When credentials are specified, it is possible that the chosen protocol would fail to connect with them. Fallback will use PSSessionConfiguration to create a session configuration on a remote machine that uses provided set of credentials by default. A new session...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-RandomPassword.ps1
PowerShell
mit
2,763
development
1,182
function Get-RandomPassword { # generates a random secure password of a specified length [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] Param ( $Length = 15, [switch]$AsPlainText ) $vocabulary = @{ Group1 = 'ABCDEFGHI...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Set-FileSystemSetting.ps1
PowerShell
mit
2,763
development
3,757
function Set-FileSystemSetting { # not available in SQL WMI [CmdletBinding()] param ( [DbaInstance]$Instance, [PSCredential]$Credential, [string]$ShareName, [int]$FilestreamLevel, [switch]$EnableException ) begin { function Get-FilestreamReturnValue { ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-DbaFileStreamFolder.ps1
PowerShell
mit
2,763
development
2,869
function Get-DbaFileStreamFolder { <# .SYNOPSIS Returns basic information about Filestream folders from a Sql Instance .DESCRIPTION Given a SQL Instance, and an optional list of databases returns the FileStream containing folders on that Instance. Without the Database parameter, all dbs wi...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-DbaDbCorruption.ps1
PowerShell
mit
2,763
development
8,441
function Invoke-DbaDbCorruption { <# .SYNOPSIS Utilizes the DBCC WRITEPAGE functionality to corrupt a specific database table for testing. In no uncertain terms, this is a non-production command. This will absolutely break your databases and that is its only purpose. Using DBCC WritePage w...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-Create.ps1
PowerShell
mit
2,763
development
516
function Invoke-Create { <# For stubborn .net objects that won't throw properly #> [CmdletBinding(SupportsShouldProcess)] param ( [object]$Object ) process { if ($Object.Name) { $Name = $Object.Name } else { $Name = "target object" ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-OfflineSqlFileStructure.ps1
PowerShell
mit
2,763
development
2,103
function Get-OfflineSqlFileStructure { <# .SYNOPSIS Internal function. Returns dictionary object that contains file structures for SQL databases. #> [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] [ValidateNotNullOrEmpty()] [object]$SqlInstance, [Parameter...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-SqlDefaultSpConfigure.ps1
PowerShell
mit
2,763
development
40,056
function Get-SqlDefaultSpConfigure { <# .SYNOPSIS Internal function. Returns the default sp_configure options for a given version of SQL Server. .NOTES Server Configuration Options BOL (links subject to change): SQL Server 2019 - https://technet.microsoft.com/en-us/library/m...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-SqlLoginAccess.ps1
PowerShell
mit
2,763
development
943
function Test-SqlLoginAccess { <# .SYNOPSIS Internal function. Ensures login has access on SQL Server. #> [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [object]$SqlInstance, [PSCredential]$SqlCredential, [string]$Login ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-DbaDiagnosticQueryScriptParser.ps1
PowerShell
mit
2,763
development
2,841
function Invoke-DbaDiagnosticQueryScriptParser { [CmdletBinding(DefaultParameterSetName = "Default")] Param( [parameter(Mandatory)] [ValidateScript( { Test-Path $_ })] [System.IO.FileInfo]$filename, [Switch]$ExcludeQueryTextColumn, [Switch]$ExcludePlanColumn, [Sw...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Join-AdminUnc.ps1
PowerShell
mit
2,763
development
709
function Join-AdminUnc { <# .SYNOPSIS Internal function. Parses a path to make it an admin UNC. #> [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$servername, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [s...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-DbaRestoreVersion.ps1
PowerShell
mit
2,763
development
3,645
function Test-DbaRestoreVersion { <# .SYNOPSIS Checks that the restore files are from a version of SQL Server that can be restored on the target version .DESCRIPTION Finds the anchoring Full backup (or multiple if it's a striped set). Then filters to ensure that all the backups are ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-Program.ps1
PowerShell
mit
2,763
development
8,260
function Invoke-Program { <# .SYNOPSIS Invokes a remote execution of a file using specific credentials. .DESCRIPTION Based on https://github.com/adbertram/PSSqlUpdater Invokes a remote execution of a file passing credentials over the network to avoid a double-hop issue and gain privileg...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-DbaLSN.ps1
PowerShell
mit
2,763
development
1,962
function Convert-DbaLSN { <# .SYNOPSIS Converts Lsns betweent Hex and/or numeric formats .DESCRIPTION Function takes an LSN in either split Hexadecimal format () or numberic It then returns both formats in an object .PARAMETER LSN The LSN value to be converted .EX...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Add-ConnectionHashValue.ps1
PowerShell
mit
2,763
development
533
function Add-ConnectionHashValue { param( [Parameter(Mandatory)] $Key, [Parameter(Mandatory)] $Value ) Write-Message -Level Debug -Message "Adding to connection hash" if ($Value.ConnectionContext.NonPooledConnection -or $Value.NonPooledConnection) { if (-not $scr...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Find-SqlInstanceUpdate.ps1
PowerShell
mit
2,763
development
2,419
function Find-SqlInstanceUpdate { <# .SYNOPSIS Returns a SQL Server KB filesystem object based on parameters .DESCRIPTION Recursively searches specified folder for a file that matches the following pattern: "SQLServer$MajorVersion*-KB$KB-*$Architecture*.exe" ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Convert-DbaIndexToTable.ps1
PowerShell
mit
2,763
development
4,595
function Convert-DbaIndexToTable { [CmdLetBinding()] param( [DbaInstanceParameter]$SqlInstance, [PSCredential]$SqlCredential, [string[]]$Database, [string[]]$Schema, [string[]]$Table, [string[]]$Index, [switch]$Unique, [switch]$EnableException ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-SqlDefaultPaths.ps1
PowerShell
mit
2,763
development
2,036
function Get-SqlDefaultPaths { <# .SYNOPSIS Internal function. Returns the default data and log paths for SQL Server. Needed because SMO's server.defaultpath is sometimes null. #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")] param ( ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-XpDirTreeRestoreFile.ps1
PowerShell
mit
2,763
development
4,154
function Get-XpDirTreeRestoreFile { <# .SYNOPSIS Internal Function to get SQL Server backfiles from a specified folder using xp_dirtree .DESCRIPTION Takes path, checks for validity. Scans for usual backup file .PARAMETER Path The path to retrieve the restore for. .PARAMETE...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Restart-WinRMService.ps1
PowerShell
mit
2,763
development
2,829
function Restart-WinRMService { <# .SYNOPSIS Restarts WinRM service on a remote machine and waits for it to get back up .DESCRIPTION Restarts WinRM service on a remote machine and waits for it to get back up by attempting to establish a WinRM session. #> [CmdletBinding(SupportsShoul...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Unregister-RemoteSessionConfiguration.ps1
PowerShell
mit
2,763
development
2,285
function Unregister-RemoteSessionConfiguration { <# .SYNOPSIS Unregisters a PSSessionConfiguration on a remote machine .DESCRIPTION Unregisters a session previously created with Register-RemoteSessionConfiguration through WinRM. #> [CmdletBinding(SupportsShouldProcess)] Param ( ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Connect-AsServer.ps1
PowerShell
mit
2,763
development
1,693
function Connect-AsServer { <# .SYNOPSIS Internal function that creates SMO server object. .DESCRIPTION Internal function that creates SMO server object. .PARAMETER AsServer Analysis Server .PARAMETER ParameterConnection Shorten the timeout .NOTES Website: https://dbatools.io Copyright: (c) 2018 by dbatools, li...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/ConvertTo-JsDate.ps1
PowerShell
mit
2,763
development
1,410
function ConvertTo-JsDate { <# .SYNOPSIS Converts Datetime input to a Java Script date format .DESCRIPTION This function acceptes date time input and converts to a Java script compatible format. Java Script date time format: New date (yyyy, MM, dd...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-InternalService.ps1
PowerShell
mit
2,763
development
5,219
function Get-InternalService { <# .SYNOPSIS Uses WMI/CIM to scan for the existance of a specific windows services. .DESCRIPTION Uses WMI/CIM to scan for the existance of a specific windows services. Use Get-InternalService if you are interested in scanning for sql server services e...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Get-CodePage.ps1
PowerShell
mit
2,763
development
699
function Get-CodePage { <# .SYNOPSIS Converts Microsoft's code page ID to human readable format .DESCRIPTION Converts Microsoft's code page ID to human readable format .PARAMETER Id The code page ID .EXAMPLE Get-CodePage 1252 ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Connect-ConnstringInstance.ps1
PowerShell
mit
2,763
development
2,285
function Connect-ConnstringInstance { <# .SYNOPSIS Internal function to establish smo connections using a connstring .DESCRIPTION Internal function to establish smo connections using a connstring Can interpret any of the following types of information: - String - Smo...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/New-DbaLogShippingPrimaryDatabase.ps1
PowerShell
mit
2,763
development
17,999
function New-DbaLogShippingPrimaryDatabase { <# .SYNOPSIS New-DbaLogShippingPrimaryDatabase add the primary database to log shipping .DESCRIPTION New-DbaLogShippingPrimaryDatabase will add the primary database to log shipping. This is executed on the primary serv...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-PSRemoting.ps1
PowerShell
mit
2,763
development
1,586
#requires -version 3.0 function Test-PSRemoting { <# Jeff Hicks https://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUsePSCredentialType", "")] [Cmdletbinding()] param( [Parameter(Mandatory, ValueF...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Test-ShouldProcess.ps1
PowerShell
mit
2,763
development
352
function Test-ShouldProcess { <# .SYNOPSIS Internal function. To use instead of $PSCmdlet.ShouldProcess($x, "Message") as Test-ShouldProcess -Context $PSCmdlet -Target $x -Action "Message" #> param ( $Context, [string]$Target, [string]$Action ) $Context.S...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Update-SqlDbReadOnly.ps1
PowerShell
mit
2,763
development
1,435
function Update-SqlDbReadOnly { <# .SYNOPSIS Internal function. Updates specified database to read-only or read-write. Necessary because SMO doesn't appear to support NO_WAIT. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBin...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Invoke-DbaAsync.ps1
PowerShell
mit
2,763
development
15,186
function Invoke-DbaAsync { <# .SYNOPSIS Runs a T-SQL script. .DESCRIPTION Runs a T-SQL script. It's a stripped down version of https://github.com/dataplat/Invoke-SqlCmd2 and adapted to use dbatools' facilities. If you're looking for a public usable function, see ...
github
dataplat/dbatools
https://github.com/dataplat/dbatools
private/functions/Write-ProgressHelper.ps1
PowerShell
mit
2,763
development
2,098
function Write-ProgressHelper { # thanks adam! # https://www.adamtheautomator.com/building-progress-bar-powershell-scripts/ param ( [int]$StepNumber, [string]$Activity, [string]$Message, [int]$TotalSteps, [Alias("NoProgress")] [switch]$ExcludePercent, ...