-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
powershell.json
81 lines (81 loc) · 2.87 KB
/
powershell.json
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
{
/*
// Place your snippets for PowerShell here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"365-LicenseObject": {
"prefix": "O365-LicenseObject",
"body": [
"\\$enabledplans = 'SHAREPOINTWAC','YAMMER_ENTERPRISE','SHAREPOINTSTANDARD'",
"",
"#Get the licensesku and create the Disabled ServicePlans object",
"\\$licensesku = Get-AzureADSubscribedSku | Where-Object {\\$_.SkuPartNumber -eq '${License}'} ",
"\r",
"#Loop through all the individual plans and disable all plans except the one in \\$enabledplans",
"\\$disabledplans = \\$licensesku.ServicePlans | ForEach-Object -Process { ",
"\\$_ | Where-Object -FilterScript {\\$_.ServicePlanName -notin \\$enabledplans }",
"}",
"#Create the AssignedLicense object with the License and disabledplans created earlier\r",
"\\$licenseobj = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense\r",
"\\$licenseobj.SkuId = \\$licensesku.SkuId\r",
"\\$licenseobj.disabledplans = \\$disabledplans.ServicePlanId\r",
"\r",
"#Create the AssignedLicenses Object. Remove Licenses has to be declared as a null value",
"\\$assignedlicenseobj = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses\r",
"\\$assignedlicenseobj.AddLicenses = \\$licenseobj\r",
"\\$assignedlicenseobj.RemoveLicenses = @()"
],
"description": "Creates an O365 License Object"
},
"Output-Object": {
"prefix": "Output Object",
"body": [
"\\$OutputObj = New-Object -TypeName psobject -Property \\$properties"
],
"description": "Creates a PSCustomObject"
},
"Select-Expression": {
"prefix": "Select-Expression",
"body": [
"Select-Object @{name='${PropertyName}';expression={\\$_}}"
],
"description": "Creates a PSCustomObject"
},
"PSCustomObject": {
"prefix": "PSCustomObject",
"body": [
"[pscustomobject]@{\r",
"\t'${item1}' = ${Property1}\r",
"\t'${item2}' = ${Property2}\r",
"\t'${item3}' = ${Property3}\r",
"\t'${item4}' = ${Property4}\r",
"}"
],
"description": "Creates a PSCustomObject"
},
"New-ADGroup": {
"prefix": "New-ADGroup",
"body": [
"\\$params = @{\r",
"\tName = '${Groupname}'\r",
"\tSamAccountName = '${Groupname}'\r",
"\tGroupCategory = '${Category}'\r",
"\tGroupScope = '${GroupScope}'\r",
"\tpath = 'ou=${SubOU},ou=Groups,ou=${ParentOU},dc=bbds,dc=balfourbeatty,dc=com'\r",
"}\r",
"\tNew-ADGroup @params"
],
"description": "Creates New AD Group Hashtable"
}
}