Skip to content

Commit 929516a

Browse files
author
jkeithb
committed
Adding Utility for GDPR DSR
Adding Utilities folder & GDPR DSR script
1 parent 64b6390 commit 929516a

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
2+
<#PSScriptInfo
3+
4+
.VERSION 0.1.0
5+
6+
.GUID 788b94eb-f6f0-400d-b259-2e15c3f102ee
7+
8+
.AUTHOR J. Keith Bankston
9+
10+
.COMPANYNAME Microsoft
11+
12+
.COPYRIGHT Microsoft, 2018
13+
14+
.TAGS GalleryUtility,GDPR
15+
16+
.LICENSEURI
17+
18+
.PROJECTURI
19+
20+
.ICONURI
21+
22+
.RELEASENOTES
23+
Version 0.1.0 - Initial Version. See description for use information.
24+
25+
26+
.PRIVATEDATA
27+
28+
#>
29+
30+
<#
31+
32+
.DESCRIPTION
33+
This script will save all versions of all scripts and modules published to the PowerShell Gallery by a given Author.
34+
The Author is specified in the manifest for each item, and is expected to be consistent for a given user.
35+
36+
The script assumes that there is at least 1 version of every item that is listed.
37+
This can be verified by logging into the PowerShell Gallery, navigating to https://www.powershellgallery.com/account/Packages.
38+
If there are items that are hidden, they will be shown at the bottom of that page under the header: "Unlisted Items"
39+
40+
Use instructions:
41+
* Provide the AuthorName, which is the Author used in the item manifest.
42+
Note that the Author is not guaranteed to match the Owner, which is the account name for those who publish the item.
43+
* Provide the LocalFolder to place all the PowerShell Gallery items into.
44+
45+
For questions on this script, email [email protected]
46+
47+
#>
48+
49+
[CmdletBinding()]
50+
param(
51+
[Parameter(Mandatory = $true)]
52+
[string] $AuthorName,
53+
54+
[Parameter(Mandatory = $true)]
55+
[string] $LocalFolder
56+
)
57+
58+
59+
If (-not (test-path -path $LocalFolder)) {
60+
write-verbose "Creating folder $LocalFolder"
61+
new-item $LocalFolder -itemtype Directory
62+
}
63+
64+
65+
Write-Host "Retrieving all modules published by the author $AuthorName"
66+
67+
find-module -repository psgallery |Where-Object {
68+
if($_.Author.count -eq 1) {
69+
$_.Author -eq $AuthorName
70+
}
71+
else {
72+
$_.Author -contains $AuthorName
73+
}
74+
} | ForEach-Object {
75+
Write-Verbose "Retrieving all versions of $($_.Name)"
76+
77+
Find-Module -Name $_.Name -repository psgallery -AllowPrerelease -AllVersions | Foreach-Object {
78+
Save-Module -Name $_.Name -RequiredVersion $_.Version -Path $LocalFolder -Repository psgallery -AllowPrerelease
79+
}
80+
}
81+
82+
83+
84+
Write-Host "Retrieving all scripts published by the author $AuthorName"
85+
86+
find-script -repository psgallery |Where-Object {
87+
if($_.Author.count -eq 1) {
88+
$_.Author -eq $AuthorName
89+
}
90+
else {
91+
$_.Author -contains $AuthorName
92+
}
93+
} | ForEach-Object {
94+
Write-Verbose "Retrieving all versions of $($_.Name)"
95+
96+
Find-Script -Name $_.Name -repository psgallery -AllowPrerelease -AllVersions | Foreach-Object {
97+
Save-Scrip -Name $_.Name -RequiredVersion $_.Version -Path $LocalFolder -Repository psgallery -AllowPrerelease
98+
}
99+
}
100+

0 commit comments

Comments
 (0)