-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy-DbaPolicyManagement.html
880 lines (852 loc) · 35.1 KB
/
Copy-DbaPolicyManagement.html
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>dbatools docs | Copy-DbaPolicyManagement</title>
<link rel="icon" href="https://dbatools.io/wp-content/uploads/2016/05/dbatools.png" sizes="32x32">
<link rel="icon" href="https://dbatools.io/wp-content/uploads/2016/05/dbatools.png" sizes="192x192">
<link rel="apple-touch-icon-precomposed" href="https://dbatools.io/wp-content/uploads/2016/05/dbatools.png">
<meta name="msapplication-TileImage" content="https://dbatools.io/wp-content/uploads/2016/05/dbatools.png">
<link title="Search" rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml">
<meta name="keywords" content="dbatools, ,powershell,sql server,devops,json">
<meta name="subtitle" content="Docs for Copy-DbaPolicyManagement">
<meta property="og:type" content="article" />
<meta property="og:title" content="dbatools docs: Copy-DbaPolicyManagement" />
<meta property="og:url" content="https://docs.dbatools.io/Copy-DbaPolicyManagement.html" />
<meta property="og:description" content="dbatools docs for Copy-DbaPolicyManagement" />
<meta property="og:site_name" content="docs.dbatools.io" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:text:title" content="dbatools docs: Copy-DbaPolicyManagement" />
<meta name="twitter:image" content="https://docs.dbatools.io/assets/thumbs/Copy-DbaPolicyManagement.png">
<meta name="twitter:card" content="summary_large_image">
<meta name=twitter:creator content="@psdbatools">
<meta name=twitter:title content="dbatools docs: Copy-DbaPolicyManagement">
<meta property="twitter:site" content="@psdbatools" />
<meta property="og:image" content="https://docs.dbatools.io/assets/thumbs/Copy-DbaPolicyManagement.png">
<link rel=canonical href="https://docs.dbatools.io/Copy-DbaPolicyManagement.html" />
<link rel=alternate type=application/json
href=https://raw.githubusercontent.com/dataplat/dbatools/master/bin/dbatools-index.json
title="dbatools documentation">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" type="text/css"
href="//cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic-bootstrap.min.css">
<link rel="stylesheet" type="text/css"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
<link rel="stylesheet" href="assets/css/layout.css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-80639740-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-80639740-2');
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/autolinker/1.7.1/Autolinker.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqcloud2@2.0.3/dist/jqcloud.min.js"
integrity="sha256-+krhsKJpvd3AZYVGHcwyCUGO01uNdGSTvqR7Apcy30E=" crossorigin="anonymous"></script>
<script type="text/javascript" language="javascript">
function register_dbatools_hljs(dbatoolscommands) {
hljs.registerLanguage("powershell", function (e) {
var t = {
b: "`[\\s\\S]",
r: 0
},
o = {
cN: "variable",
v: [{
b: /\$[\w\d][\w\d_:]*/
}]
},
r = {
cN: "literal",
b: /\$(null|true|false)\b/
},
n = {
cN: "string",
v: [{
b: /"/,
e: /"/
}, {
b: /@"/,
e: /^"@/
}],
c: [t, o, {
cN: "variable",
b: /\$[A-z]/,
e: /[^A-z]/
}]
},
a = {
cN: "string",
v: [{
b: /'/,
e: /'/
}, {
b: /@'/,
e: /^'@/
}]
},
i = {
cN: "doctag",
v: [{
b: /\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/
}, {
b: /\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/
}]
},
s = e.inherit(e.C(null, null), {
v: [{
b: /#/,
e: /$/
}, {
b: /<#/,
e: /#>/
}],
c: [i]
});
return {
aliases: ["ps"],
l: /-?[A-z\.\-]+/,
cI: !0,
k: {
keyword: "if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",
built_in: dbatoolscommands + " Add-Computer Add-Content Add-History Add-JobTrigger Add-Member Add-PSSnapin Add-Type Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession Connect-WSMan Convert-Path ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString ConvertTo-Xml Copy-Item Copy-ItemProperty Debug-Process Disable-ComputerRestore Disable-JobTrigger Disable-PSBreakpoint Disable-PSRemoting Disable-PSSessionConfiguration Disable-WSManCredSSP Disconnect-PSSession Disconnect-WSMan Disable-ScheduledJob Enable-ComputerRestore Enable-JobTrigger Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration Enable-ScheduledJob Enable-WSManCredSSP Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter Export-Csv Export-FormatData Export-ModuleMember Export-PSSession ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Host Get-HotFix Get-Help Get-History Get-IseSnippet Get-Item Get-ItemProperty Get-Job Get-JobTrigger Get-Location Get-Member Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-ScheduledJob Get-ScheduledJobOption Get-Service Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb Get-WinEvent Get-WmiObject Get-WSManCredSSP Get-WSManInstance Group-Object Import-Alias Import-Clixml Import-Counter Import-Csv Import-IseSnippet Import-LocalizedData Import-PSSession Import-Module Invoke-AsWorkflow Invoke-Command Invoke-Expression Invoke-History Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod Invoke-WSManAction Join-Path Limit-EventLog Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Event New-EventLog New-IseSnippet New-Item New-ItemProperty New-JobTrigger New-Object New-Module New-ModuleManifest New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption New-PSTransportOption New-PSWorkflowExecutionOption New-PSWorkflowSession New-ScheduledJobOption New-Service New-TimeSpan New-Variable New-WebServiceProxy New-WinEvent New-WSManInstance New-WSManSessionOption Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Receive-Job Register-EngineEvent Register-ObjectEvent Register-PSSessionConfiguration Register-ScheduledJob Register-WmiEvent Remove-Computer Remove-Event Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-JobTrigger Remove-Module Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData Remove-Variable Remove-WmiObject Remove-WSManInstance Rename-Computer Rename-Item Rename-ItemProperty Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service Restore-Computer Resume-Job Resume-Service Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-JobTrigger Set-Location Set-PSBreakpoint Set-PSDebug Set-PSSessionConfiguration Set-ScheduledJob Set-ScheduledJobOption Set-Service Set-StrictMode Set-TraceSource Set-Variable Set-WmiInstance Set-WSManInstance Set-WSManQuickConfig Show-Command Show-ControlPanelItem Show-EventLog Sort-Object Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript Suspend-Job Suspend-Service Tee-Object Test-ComputerSecureChannel Test-Connection Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration Unregister-ScheduledJob Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog Write-Host Write-Output Write-Progress Write-Verbose Write-Warning Add-MDTPersistentDrive Disable-MDTMonitorService Enable-MDTMonitorService Get-MDTDeploymentShareStatistics Get-MDTMonitorData Get-MDTOperatingSystemCatalog Get-MDTPersistentDrive Import-MDTApplication Import-MDTDriver Import-MDTOperatingSystem Import-MDTPackage Import-MDTTaskSequence New-MDTDatabase Remove-MDTMonitorData Remove-MDTPersistentDrive Restore-MDTPersistentDrive Set-MDTMonitorData Test-MDTDeploymentShare Test-MDTMonitorData Update-MDTDatabaseSchema Update-MDTDeploymentShare Update-MDTLinkedDS Update-MDTMedia Update-MDTMedia Add-VamtProductKey Export-VamtData Find-VamtManagedMachine Get-VamtConfirmationId Get-VamtProduct Get-VamtProductKey Import-VamtData Initialize-VamtData Install-VamtConfirmationId Install-VamtProductActivation Install-VamtProductKey Update-VamtProduct",
nomarkup: "-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"
},
c: [t, e.NM, n, a, r, o, s]
}
});
}
$(document).ready(function () {
function render_doc(doc_to_render, examples_mode) {
$("#rendered h5").each(function (i, el) {
if ($(el).text().startsWith('-')) {
$(el).addClass('param')
}
})
$('#rendered table').addClass('table table-sm table-hover')
if (examples_mode == 'new') {
$('#rendered code').addClass('powershell')
}
$('#rendered code').each(function (i, block) {
hljs.highlightBlock(block);
})
var authorcontent = $("td:contains('Author')").next('td').addClass('dbatools_author').text()
$("#rendered .dbatools_author").html(Autolinker.link(authorcontent, {
className: 'myLink',
mention: 'twitter'
})
)
$("#rendered h2#syntax").next().find('code').addClass('wrapped')
if (ClipboardJS.isSupported()) {
$("#rendered h5[id^='example-']").append('<div class="bd-clipboard"><button class="btn-clipboard" title="Copy to clipboard">Copy</button></div>')
new ClipboardJS('.btn-clipboard', {
text: function (trigger) {
var textlines = $(trigger).parent().parent().next('pre').find('code').text().split('\n')
var copied = []
_.forEach(textlines, function (row) {
copied.push(row.replace(/^PS C:\\> /, "").replace(/^>>/, ""))
})
return _.join(copied, '\n')
}
});
}
//not all code is a block
$("#rendered h3[id*='-parameters']").nextAll().find('code').addClass('hljs-inline')
$('#rendered #description').nextUntil('#rendered #syntax').find('code').addClass('hljs-inline')
}
$('#loader').removeClass('invisible')
var index_url = 'assets/dbatools-index.json'
var external_url = 'assets/external.json'
var values = [];
var options = {
valueNames: ['CommandName', 'Description', 'Alias', 'Examples', 'Params'],
item: '<a class="list-group-item" href="#"><span class="CommandName"></span></a>'
}
cmdlist = new List('cmdlist', options, values);
var indexhelp = ''
var allcmds = $.getJSON(index_url, function (data) {
indexhelp = data
cmdlist.add(data)
var dbacommands = []
var cloudlist = {}
_.forEach(data, function (el) {
dbacommands.push(el.CommandName)
if (_.isArray(el.Tags)) {
_.forEach(el.Tags, function (el) {
if (!_.has(cloudlist, el)) {
cloudlist[el] = 0
}
cloudlist[el] += 1
})
} else if (!_.isUndefined(el.Tags)){
if (!_.has(cloudlist, el.Tags)) {
cloudlist[el.Tags] = 0
}
cloudlist[el.Tags] += 1
}
})
var weightedVals = []
_.forEach(cloudlist, function (value, key) {
weightedVals.push({
text: key,
weight: value,
handlers: {
click: function () { $('#search-ft').val('tag:' + key).trigger('keyup') }
}
})
})
var pixelHeight = window.innerHeight * 0.65;
$('#canvas').css({ 'height': pixelHeight + 'px' });
$('#canvas').jQCloud(weightedVals, {
autoResize: true
});
register_dbatools_hljs(dbacommands.join(' '))
$(window).trigger('hashchange');
})
var options2 = {
valueNames: ['extName', { name: 'extHref', attr: 'href' }],
item: '<div><a class="list-group-item list-group-item-secondary extHref" href="#" _target="_blank"><span class="extName"></span></a></div>'
}
extlist = new List('extlist', options2, [])
$.getJSON(external_url, function (data) {
$('#dbatools_version').text('(v ' + data.version + ')')
_.forEach(data.external_links, function (el) {
extlist.add({ 'extName': el.name, 'extHref': el.href })
})
})
cmdlist.on('searchComplete', function (e) {
if (cmdlist.matchingItems.length === 0) {
var searchString = $('#search-ft').val().trim();
if (searchString.length > 0 && !searchString.startsWith("ft:")) {
if (searchString != "f" && searchString != "ft" && searchString != "ft:") {
$('#search-ft').val("ft:" + searchString)
}
}
}
})
$(document).on('mouseenter', '#cmdlist', function (e) {
$('#search-ft').blur();
})
cmdlist.on('updated', function() {
$('#cmdlist a').each(function(i, el) {
$(el).attr('href', $(el).find('span.CommandName').text())
})
})
$('#cmdlist').on('mouseenter', 'a', function (e) {
$(this).attr('href', $(this).find('span.CommandName').text());
/*
e.preventDefault();
window.location.href = $(this).find('span.CommandName').text()
---
window.location.hash = '#' + $(this).find('span.CommandName').text();
$('#cmdlist').find('a.active').removeClass('active')
$(this).addClass('active')
*/
})
$('#search-ft').bind('change keyup', function () {
var searchString = $(this).val();
if (searchString.trim() == "ft:" || searchString.trim() == "tag:") {
extlist.search();
}
else if (searchString.startsWith("ft:")) {
searchString = searchString.substring(3).trim();
if (cmdlist.filtered) {
cmdlist.filter();
}
cmdlist.search(searchString, ['CommandName', 'Alias', 'Description', 'Synopsis', 'Examples', 'Params']);
} else if (searchString.startsWith("tag:")) {
searchString = searchString.substring(4).trim();
if (cmdlist.searched) {
cmdlist.search();
}
cmdlist.filter(function (item) {
if (_.indexOf(item.values().Tags, searchString) !== -1) {
return true;
} else {
return false;
}
});
} else {
if (cmdlist.filtered) {
cmdlist.filter();
}
cmdlist.search(searchString, ['CommandName', 'Alias']);
}
extlist.search('$$$')
if (_.isEmpty(searchString)) {
extlist.search()
cmdlist.filter()
}
})
$('#clear-search').on('click', function () {
$('#search-ft').val('').trigger('keyup')
})
$(window).on('hashchange', function (e) {
var hash = window.location.hash.substr(1);
var pagename = window.location.pathname.split("/").filter(function (c) { return c.length; }).pop();
if (_.isUndefined(pagename)) {
pagename = ''
} else {
pagename = pagename.split('.')[0];
}
if (hash.length == 0) {
hash = pagename
}
if (hash.length > 0) {
//ends with /
if (_.endsWith(hash, '/')) {
window.location.hash = '#' + hash.slice(0, hash.length - 1)
$(window).trigger('hashchange');
return;
}
//exact match
var topublish = _.findIndex(indexhelp, { 'Name': hash })
if (topublish == -1) {
//lowercase match
var topublish = _.findIndex(indexhelp, function (el) { return _.toLower(el.Name) == _.toLower(hash) })
if (topublish == -1) {
//alias match
var topublish = _.findIndex(indexhelp, { 'Alias': hash })
if (topublish == -1) {
//lowercase alias match
var topublish = _.findIndex(indexhelp, function (el) { return _.toLower(el.Alias) == _.toLower(hash) })
}
if (topublish == -1) {
//multiple aliases, optionally lowercased
var topublish = _.findIndex(indexhelp, function (el) { return _.includes(_.toLower(el.Alias).split(','), _.toLower(hash)) })
}
}
if (topublish !== -1) {
//normalization of URI
window.location.hash = '#' + indexhelp[topublish].CommandName
$(window).trigger('hashchange')
return;
}
}
if (topublish == -1) {
$('#rendered').html(marked.parse('### 404 Function not found \n (while searching for ' + hash + '). Please visit dbatools.io/commands for an updated index of current commands.'));
} else {
var doc_to_render = indexhelp[topublish]
render_doc(doc_to_render, 'new')
$("body").data("doc_to_render", indexhelp[topublish])
if ($("#headscroll").offset().top > 150) {
$(window).scrollTo('#headscroll')
} else {
$(window).scrollTo(0, 800)
}
}
} else {
$('#loader').addClass('invisible')
}
})
$(window).scroll(function () {
if ($(this).scrollTop() > 50) {
$('#back-to-top').fadeIn();
} else {
$('#back-to-top').fadeOut();
}
})
$('#back-to-top').click(function () {
$(window).scrollTo(0, 800)
return false;
})
})
</script>
</head>
<body>
<nav class="navbar navbar-expand-md customnav">
<a href="https://docs.dbatools.io/" class="navbar-brand" rel="home" itemprop="url">
<img width="265" height="64" src="https://dbatools.io/wp-content/uploads/2018/09/dbatools-docs.png"
class="custom-logo" alt="dbatools" itemprop="logo" scale="0">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="oi oi-menu"></span>
</button>
<div class="collapse navbar-collapse flex-grow-1 text-right" id="navbarCollapse">
<ul class="navbar-nav ml-auto flex-nowrap">
<li class="nav-item">
<a class="nav-link" style="color:#293E5D" href="https://dbatools.io/download/">⬇ download</a>
</li>
<li class="nav-item">
<a class="nav-link" style="color:#293E5D" href="https://dbatools.io/commands/">🚀 commands</a>
</li>
<li class="nav-item">
<a class="nav-link" style="color:#293E5D" href="https://dbatools.io/slack">🔍 find us</a>
</li>
<li class="nav-item">
<a class="nav-link" style="color:#293E5D" href="https://dbatools.io/builds">🔢 build ref</a>
</li>
<li class="nav-item">
<a class="nav-link" style="color:#293E5D" href="https://dbatools.io/book">📘 dbatools book</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<hr />
</div>
</div>
<div class="row">
<div class="col-xl-3 col-lg-5 col-md-5 col-sm-12 bd-sidebar">
<div id="relcommands" class="">
<h3>
commands
<small id="dbatools_version" class="text-muted"></small>
</h3>
<p></p>
<div class="form-group row">
<div class="col-lg-12">
<div class="input-group">
<input type="text" class="form-control" id="search-ft"
placeholder="Search ("ft: term" enables fulltext)" autocomplete="off">
<div class="input-group-append">
<div class="input-group-text" id="clear-search">Clear</div>
</div>
</div>
</div>
</div>
<div id="extlist">
<div class="list list-group"></div>
</div>
<div id="cmdlist">
<div class="list list-group"></div>
</div>
</div>
</div>
<div class="col-xl-9 col-lg-7 col-md-7 col-sm-12 bd-content">
<div id="headscroll">
<a id="back-to-top" href="#" class="btn btn-primary btn-lg back-to-top" role="button"
title="Click to return on the top page">^</a>
</div>
<div id="rendered">
<h1 id="copy-dbapolicymanagement">Copy-DbaPolicyManagement</h1>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Author</strong></td>
<td>Chrissy LeMaire (@cl), netnerds.net</td>
</tr>
<tr>
<td><strong>Availability</strong></td>
<td>Windows, Linux, macOS</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Want to see the source code for this command? Check out <a href="https://github.com/dataplat/dbatools/blob/master/public/Copy-DbaPolicyManagement.ps1">Copy-DbaPolicyManagement</a> on GitHub.
<br>
Want to see the Bill Of Health for this command? Check out <a href="https://dataplat.github.io/boh#Copy-DbaPolicyManagement">Copy-DbaPolicyManagement</a>.</p>
<h2 id="synopsis">Synopsis</h2>
<p>Migrates SQL Policy Based Management Objects, including both policies and conditions.</p>
<h2 id="description">Description</h2>
<p>By default, all policies and conditions are copied. If an object already exist on the destination, it will be skipped unless -Force is used.</p>
<p>The -Policy and -Condition parameters are auto-populated for command-line completion and can be used to copy only specific objects.</p>
<h2 id="syntax">Syntax</h2>
<pre><code>Copy-DbaPolicyManagement
[-Source] <DbaInstanceParameter>
[[-SourceSqlCredential] <PSCredential>]
[-Destination] <DbaInstanceParameter[]>
[[-DestinationSqlCredential] <PSCredential>]
[[-Policy] <Object[]>]
[[-ExcludePolicy] <Object[]>]
[[-Condition] <Object[]>]
[[-ExcludeCondition] <Object[]>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
</code></pre>
<p> </p>
<h2 id="examples">Examples</h2>
<p> </p>
<h5 id="example-1">Example: 1</h5>
<pre><code>PS C:\> Copy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster
</code></pre>
<p>Copies all policies and conditions from sqlserver2014a to sqlcluster, using Windows credentials.<br></p>
<h5 id="example-2">Example: 2</h5>
<pre><code>PS C:\> Copy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred
</code></pre>
<p>Copies all policies and conditions from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.<br></p>
<h5 id="example-3">Example: 3</h5>
<pre><code>PS C:\> Copy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -WhatIf
</code></pre>
<p>Shows what would happen if the command were executed.<br></p>
<h5 id="example-4">Example: 4</h5>
<pre><code>PS C:\> Copy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -Policy 'xp_cmdshell must be disabled'
</code></pre>
<p>Copies only one policy, 'xp_cmdshell must be disabled' from sqlserver2014a to sqlcluster. No conditions are migrated.<br></p>
<h3 id="required-parameters">Required Parameters</h3>
<h5 id="source">-Source</h5>
<p>Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2008 or higher. <br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>True</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="destination">-Destination</h5>
<p>Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher. <br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>True</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="optional-parameters">Optional Parameters</h3>
<h5 id="sourcesqlcredential">-SourceSqlCredential</h5>
<p>Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).<br />
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.<br />
For MFA support, please use Connect-DbaInstance.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="destinationsqlcredential">-DestinationSqlCredential</h5>
<p>Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).<br />
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.<br />
For MFA support, please use Connect-DbaInstance.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="policy">-Policy</h5>
<p>The policy(ies) to process - this list is auto-populated from the server. If unspecified, all policies will be processed.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="excludepolicy">-ExcludePolicy</h5>
<p>The policy(ies) to exclude - this list is auto-populated from the server<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="condition">-Condition</h5>
<p>The condition(s) to process - this list is auto-populated from the server. If unspecified, all conditions will be processed.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="excludecondition">-ExcludeCondition</h5>
<p>The condition(s) to exclude - this list is auto-populated from the server<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="force">-Force</h5>
<p>If policies exists on destination server, it will be dropped and recreated.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td>False</td>
</tr>
</tbody>
</table>
<h5 id="enableexception">-EnableException</h5>
<p>By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.<br />
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.<br />
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td></td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td>False</td>
</tr>
</tbody>
</table>
<h5 id="whatif">-WhatIf</h5>
<p>Shows what would happen if the command were to run. No actions are actually performed.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td>wi</td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="confirm">-Confirm</h5>
<p>Prompts you for confirmation before executing any changing operations within the command.<br></p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Alias</td>
<td>cf</td>
</tr>
<tr>
<td>Required</td>
<td>False</td>
</tr>
<tr>
<td>Pipeline</td>
<td>false</td>
</tr>
<tr>
<td>Default Value</td>
<td></td>
</tr>
</tbody>
</table>
<p> </p>
</div> <!-- rendered -->
</div>
</div>
</div>
</body>
</html>