Skip to content

Commit 12ce0ba

Browse files
authored
Merge pull request #71 from JosephMcEvoy/Dev
Add Connect-PSZoom. !deploy
2 parents c7314dd + 54fd0d8 commit 12ce0ba

File tree

116 files changed

+511
-2455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+511
-2455
lines changed

Examples/Get-ZoomInactiveUsers.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ Default is 6 months from current day.
1515
.PARAMETER To
1616
The end date in 'yyyy-MM-dd' format. Default is the current date.
1717
18-
.PARAMETER ApiKey
19-
The Api Key.
20-
21-
.PARAMETER ApiSecret
22-
The Api Secret.
23-
2418
.OUTPUTS
2519
2620
.LINK

Examples/New-CompanyZoomUser.ps1

Lines changed: 63 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ with a single host and cannot be modified for these accounts.
7575
If the value is set to `true`, the meeting passcode will be encrypted and included in the join meeting link to allow
7676
participants to join with just one click without having to enter the passcode.
7777
78-
.PARAMETER ApiKey
79-
The API key.
80-
81-
.PARAMETER ApiSecret
82-
THe API secret.
83-
8478
.OUTPUTS
8579
No output. Can use Passthru switch to pass UserId to output.
8680
@@ -225,17 +219,7 @@ function New-CompanyZoomUser {
225219

226220
[Parameter(ValueFromPipelineByPropertyName = $True)]
227221
[Alias('embed_password_in_join_link')]
228-
[bool]$EmbedPasswordInJoinLink,
229-
230-
[Parameter(ParameterSetName = 'AdAccount')]
231-
[Parameter(ParameterSetName = 'Manual')]
232-
[ValidateNotNullOrEmpty()]
233-
[string]$ApiKey,
234-
235-
[Parameter(ParameterSetName = 'AdAccount')]
236-
[Parameter(ParameterSetName = 'Manual')]
237-
[ValidateNotNullOrEmpty()]
238-
[string]$ApiSecret
222+
[bool]$EmbedPasswordInJoinLink
239223
)
240224

241225
process {
@@ -281,101 +265,89 @@ function New-CompanyZoomUser {
281265
'OfficeeName3' { 'Office 3' }
282266
}
283267

284-
$GroupID = ((Get-ZoomGroups) | where-object {$_ -match "$OfficeLocation"}).id
268+
$GroupID = ((Get-ZoomGroups) | where-object { $_ -match "$OfficeLocation" }).id
285269

286270
$params.Add('GroupId', $GroupId)
287-
}
288-
289-
if ($ApiKey) {
290-
$params.Add('ApiKey', $ApiKey)
291-
}
292-
293-
if ($ApiKey) {
294-
$params.Add('ApiSecret', $ApiSecret)
295-
}
296271

297-
New-CompanyZoomUser @params
298-
} elseif ($PSCmdlet.ParameterSetName -eq 'Manual') {
299-
$creds = @{
300-
ApiKey = 'ApiKey'
301-
ApiSecret = 'ApiSecret'
302-
}
303-
304-
if (Get-ZoomUser $Email -ErrorAction SilentlyContinue) {
305-
throw "User already exists in Zoom."
272+
New-CompanyZoomUser @params
306273
}
274+
elseif ($PSCmdlet.ParameterSetName -eq 'Manual') {
275+
if (Get-ZoomUser $Email -ErrorAction SilentlyContinue) {
276+
throw "User already exists in Zoom."
277+
}
307278

308-
#Create new user
309-
$defaultNewUserParams = @{
310-
Action = $Action
311-
Type = $Type
312-
Email = $Email
313-
}
279+
#Create new user
280+
$defaultNewUserParams = @{
281+
Action = $Action
282+
Type = $Type
283+
Email = $Email
284+
}
314285

315-
function Remove-NonPsBoundParameters {
316-
param (
317-
$Obj,
318-
$Parameters = $PSBoundParameters
319-
)
286+
function Remove-NonPsBoundParameters {
287+
param (
288+
$Obj,
289+
$Parameters = $PSBoundParameters
290+
)
320291

321-
process {
322-
$NewObj = @{ }
292+
process {
293+
$NewObj = @{ }
323294

324-
foreach ($Key in $Obj.Keys) {
325-
if ($Parameters.ContainsKey($Obj.$Key) -or -not [string]::IsNullOrWhiteSpace($Obj.Key)) {
326-
$Newobj.Add($Key, (get-variable $Obj.$Key).value)
295+
foreach ($Key in $Obj.Keys) {
296+
if ($Parameters.ContainsKey($Obj.$Key) -or -not [string]::IsNullOrWhiteSpace($Obj.Key)) {
297+
$Newobj.Add($Key, (get-variable $Obj.$Key).value)
298+
}
327299
}
328-
}
329300

330-
return $NewObj
301+
return $NewObj
302+
}
331303
}
332-
}
333304

334-
$newUserParams = @{
335-
FirstName = 'FirstName'
336-
LastName = 'LastName'
337-
}
305+
$newUserParams = @{
306+
FirstName = 'FirstName'
307+
LastName = 'LastName'
308+
}
338309

339-
$newUserParams = Remove-NonPsBoundParameters($newUserParams)
310+
$newUserParams = Remove-NonPsBoundParameters($newUserParams)
340311

341-
New-ZoomUser @defaultNewUserParams @newUserParams @creds
312+
New-ZoomUser @defaultNewUserParams @newUserParams @creds
342313

343-
#Update parameters that cant be entered with new user
344-
$updateParams = @{
345-
UserId = 'Email'
346-
HostKey = 'HostKey'
347-
Pmi = 'Pmi'
348-
Timezone = 'Timezone'
349-
Language = 'Language'
350-
Dept = 'Department'
351-
VanityName = 'VanityName'
352-
UsePmi = 'UsePmi'
353-
}
314+
#Update parameters that cant be entered with new user
315+
$updateParams = @{
316+
UserId = 'Email'
317+
HostKey = 'HostKey'
318+
Pmi = 'Pmi'
319+
Timezone = 'Timezone'
320+
Language = 'Language'
321+
Dept = 'Department'
322+
VanityName = 'VanityName'
323+
UsePmi = 'UsePmi'
324+
}
354325

355-
$updateParams = Remove-NonPsBoundParameters($updateParams)
326+
$updateParams = Remove-NonPsBoundParameters($updateParams)
356327

357-
Update-ZoomUser @updateParams @creds
328+
Update-ZoomUser @updateParams @creds
358329

359-
#Update Zoom User Meeting Settings
360-
$updateSettingParams = @{
361-
UserId = 'Email'
362-
RequirePasswordForSchedulingNewMeetings = 'RequirePasswordForSchedulingNewMeetings'
363-
RequirePasswordForPmiMeetings = 'RequirePasswordForPmiMeetings'
364-
EmbedPasswordInJoinLink = 'EmbedPasswordInJoinLink'
365-
}
330+
#Update Zoom User Meeting Settings
331+
$updateSettingParams = @{
332+
UserId = 'Email'
333+
RequirePasswordForSchedulingNewMeetings = 'RequirePasswordForSchedulingNewMeetings'
334+
RequirePasswordForPmiMeetings = 'RequirePasswordForPmiMeetings'
335+
EmbedPasswordInJoinLink = 'EmbedPasswordInJoinLink'
336+
}
366337

367-
$updateSettingParams = Remove-NonPsBoundParameters($updateSettingParams)
338+
$updateSettingParams = Remove-NonPsBoundParameters($updateSettingParams)
368339

369-
Update-ZoomUserSettings @updateSettingParams @creds
370-
#Add user to group
371-
if ($GroupId) {
372-
Add-ZoomGroupMember -groupid $GroupId -MemberEmail $email @creds
373-
}
340+
Update-ZoomUserSettings @updateSettingParams @creds
341+
#Add user to group
342+
if ($GroupId) {
343+
Add-ZoomGroupMember -groupid $GroupId -MemberEmail $email @creds
344+
}
374345

375-
#Add scheduling permission on behalf of Admin
376-
if ($SchedulingAssistant) {
377-
Add-ZoomUserAssistants -UserId $Email -AssistantEmail $SchedulingAssistant @creds
346+
#Add scheduling permission on behalf of Admin
347+
if ($SchedulingAssistant) {
348+
Add-ZoomUserAssistants -UserId $Email -AssistantEmail $SchedulingAssistant @creds
349+
}
378350
}
379351
}
380352
}
381-
}
353+
}

Examples/Sync-ZoomUsersWithAdGroup.ps1

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ $UserExceptions = @(
3030
$AdGroups = 'ZoomUsers'
3131
$TransferAccount = 'AVAdmin@deathstar.com'
3232
33-
Sync-ZoomUsersWithAdGroup -AdGroups $AdGroups -UserExceptions $UserExceptions -TransferAccount $TransferAccount -ApiKey $ZoomApiKey -ApiSecret $ZoomApiKey -Confirm -Verbose
34-
35-
.PARAMETER ApiKey
36-
The API key.
37-
38-
.PARAMETER ApiSecret
39-
The API secret.
33+
Sync-ZoomUsersWithAdGroup -AdGroups $AdGroups -UserExceptions $UserExceptions -TransferAccount $TransferAccount -Confirm -Verbose
4034
4135
#>
4236

@@ -63,11 +57,7 @@ function Sync-ZoomUsersWithAdGroup() {
6357

6458
[switch]$Add = $False,
6559

66-
[switch]$Remove = $False,
67-
68-
[string]$ApiKey,
69-
70-
[string]$ApiSecret
60+
[switch]$Remove = $False
7161
)
7262
begin {
7363
if ($TransferAccount) {
@@ -114,11 +104,6 @@ function Sync-ZoomUsersWithAdGroup() {
114104

115105
$AdDiff = $AdZoomDiff | Where-Object -Property SideIndicator -eq '<=' | Select-Object -Property 'EmailAddress'
116106

117-
$params = @{
118-
ApiKey = $ApiKey
119-
ApiSecret = $ApiSecret
120-
}
121-
122107
#Add users to Zoom that are in the $AdGroup and not in $UserExceptions.
123108
if ($Add) {
124109
Write-Verbose "Adding missing users that are in $AdGroup to Zoom. Skipping users in UserExceptions."

PSZoom/PSZoom.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Version number of this module.
1515

16-
ModuleVersion = '1.16.0.0'
16+
ModuleVersion = '2.0.0.0'
1717

1818
# Supported PSEditions
1919
# CompatiblePSEditions = @()
@@ -28,7 +28,7 @@
2828
CompanyName = 'Unknown'
2929

3030
# Copyright statement for this module
31-
Copyright = '(c) 2020 Joseph McEvoy. All rights reserved.'
31+
Copyright = '(c) 2022 Joseph McEvoy. All rights reserved.'
3232

3333
# Description of the functionality provided by this module
3434
Description = 'A collection of Powershell tools to interface with the Zoom Api.'

PSZoom/Private/Get-ZoomApiCredentials.ps1

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)