forked from dataplat/dbatools-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Super-Basic.ps1
80 lines (56 loc) · 2.35 KB
/
Super-Basic.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Function Verb-DbaNoun
{
<#
.SYNOPSIS
Simple template
.DESCRIPTION
By default, all SQL Agent categories for Jobs, Operators and Alerts are copied.
.PARAMETER SqlServer
The SQL Server instance.You must have sysadmin access and server version must be SQL Server version 2000 or higher.
.PARAMETER SqlCredential
Allows you to login to servers using SQL Logins as opposed to Windows Auth/Integrated/Trusted.
.NOTES
Original Author: You (@YourTwitter, Yourblog.net)
dbatools PowerShell module (https://dbatools.io, clemaire@gmail.com)
Copyright (C) 2016 Chrissy LeMaire
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
.LINK
https://dbatools.io/Verb-DbaNoun
.EXAMPLE
Verb-DbaNoun -SqlServer sqlserver2014a
Copies all policies and conditions from sqlserver2014a to sqlcluster, using Windows credentials.
.EXAMPLE
Verb-DbaNoun -SqlServer sqlserver2014a -SqlCredential $cred
Does this, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.
.EXAMPLE
Verb-DbaNoun -SqlServer sqlserver2014 -WhatIf
Shows what would happen if the command were executed.
.EXAMPLE
Verb-DbaNoun -SqlServer sqlserver2014a -Policy 'xp_cmdshell must be disabled'
Does this
#>
[CmdletBinding(SupportsShouldProcess = $true)]
Param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
[Alias("ServerInstance", "SqlInstance")]
[object]$SqlServer,
[object]$SqlCredential,
[string]$FilePath
)
DynamicParam { if ($sqlserver) { return Get-ParamSqlDatabases -SqlServer $sqlserver -SqlCredential $SqlCredential } }
BEGIN
{
$sourceserver = Connect-SqlServer -SqlServer $sqlserver -SqlCredential $SqlCredential
$source = $sourceserver.DomainInstanceName
$Databases = $psboundparameters.Databases
}
PROCESS
{
}
END
{
$sourceserver.ConnectionContext.Disconnect()
}
}