Public/SEPPmailLegacyCmdLets.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
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
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
<#
.SYNOPSIS
    This CmdLets returns licensing information.
.DESCRIPTION
    Retrieve license information about specific users or a summary report, using the -summary parameter
.EXAMPLE
    PS C:\> Get-SLLicenseInfo|Where-Object userid -like 'max@mustermann.com'
    Get the license status for a specific users
.EXAMPLE
    PS C:\> Get-SLLicenseInfo -summary
    Get the license summary of the appliance
.NOTES
    General notes
#>

function Get-SLLicenseInfo
{
    [CmdletBinding()]
    param (
    
        [Parameter(
            Mandatory = $false,
            HelpMessage = 'Receive a table with license summary info instead of single entries for each user'
        )]
        [switch]$summary
    )
    
    begin
    {
        Set-SLConfig | Out-Null
    }
    
    process
    {
        $urlroot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
        $uri = $urlroot + 'statistics' + '?' + 'returnType' + '=' + 'CSV'
        $csvstats = Invoke-RestMethod -Uri $uri -Method GET -Credential $SLConfig.secret | ConvertFrom-Csv -Delimiter ';'
        #'Account last used' Datum länger als 3 Monate her - keine Lizenz
        # wenn 'May not sign mails'-like 'YES' UND 'May not encrypt mails' -like 'YES - keine Lizenz verbraucht == Deaktiviert

        # Transform output to HT-Array and make sure to have proper values everywhere.
        $statsarray = @()
        $statsArray = $csvstats | Select-Object 'User ID', 'Registered User', 'May not sign mails', 'May not encrypt mails', 'Account last used'`
        | ForEach-Object {
            [ordered]@{    
                'userid'   = if (($_.'User ID').Length -eq '0') { 'none' } else { $_.'User ID' };
                'reguser'  = $_.'Registered user';
                'nosig'    = if (($_.'May not sign mails').Length -eq '0') { $true } else { $false };
                'noenc'    = if (($_.'May not encrypt mails').Length -eq '0') { $true } else { $false };
                'lastused' = if (($_.'Account last used').Length -eq '0') { Get-Date -Day 1 -Month 1 -Year 2000 } else { Get-Date $_.'Account last used' }
            }
        }

    }
    
    end
    {
        if ($summary)
        {
            $totalKnownUsers = ($statsArray.count)
            $totalLic = ($statsArray | Where-Object { ($_.'reguser' -eq '1') } | Measure-Object).Count
            $inactiveLic = ($statsArray | Where-Object { ($_.'reguser' -eq '0') } | Measure-Object).Count
            $nosend3m = ($statsArray | Where-Object { ($_.'reguser' -eq '1') -and ($_.'nosig' -eq $true) -and ($_.'noenc' -eq $true) -and ($_.'lastused' -gt (Get-Date).AddMonths(-3)) } | Measure-Object).Count
            $usedLic = ($statsArray | Where-Object { ($_.userid -ne 'none') -and ($_.'reguser' -eq '1') -and ($_.'nosig' -eq $true) -and ($_.'noenc' -eq $true) -and ($_.'lastused' -gt (Get-Date).AddMonths(-3)) } | Measure-Object).Count
            <# Total of 3 encryption/signature users with an account,
            but 0 set to inactive and 2 did not send mails in the last three months
            #>

            [psobject]$sum = @{
                'Total known users'                       = $totalKnownUsers
                'Total ever used licenses'                = $totalLic
                'Deactivated Licenses'                    = $inactiveLic
                'released licenses (inactive > 3 months)' = $nosend3m
                'Currently used Licenses'                 = $usedLic
            }
            return $sum

        }
        else
        {
            return $statsarray | ForEach-Object { [pscustomobject]$_ }
        }
    }
}
<#
.SYNOPSIS
    Retrieve group-membership of a SEPPmail appliance
.DESCRIPTION
    SEPPmail uses groups to control access to the web-interface and other areas. This CmdLet reads the group configuration.
.EXAMPLE
    PS C:\> Get-SLGroupInfo
    Retrieve all groups and all members
.EXAMPLE
    PS C:\> Get-SLGroupInfo -Membername max@mustermann.com
    Retrieve the membership of a specific user
#>

function Get-SLGroupInfo 
{
    [CmdletBinding()]
    param (
    
        [Parameter(
            Mandatory = $false,
            HelpMessage = 'Username to look for group membership'
        )]
        [string]$MemberName,

        [Parameter(
            Mandatory = $false,
            HelpMessage = 'Groupname to look for user membership'
        )]
        [string]$GroupName

    )

    begin
    {
        #Write-Verbose 'Writing SLConfig to $global:SLConfig'
        Set-SLConfig | Out-Null
    }

    process
    {
        $urlroot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
        $uri = $urlroot + 'groupinfo' + '?' + 'returnType' + '=' + 'CSV'
        Write-Verbose 'Call REST-API'
        $groupraw = Invoke-RestMethod -Uri $uri -Method GET -Credential $SLConfig.secret | ConvertFrom-Csv -Delimiter ';'
        
        Write-Verbose 'Transform output to HT-Array and make sure to have proper values everywhere. '
        # [0] returns object with 2 members 'group name' and 'member names'
        # GroupName param set
        if ($groupName)
        {
            if ($groupraw | Where-Object { $_.'group name' -like $groupName })
            {
                $groupraw | Where-Object { $_.'group name' -like $groupName }
            }
            else
            {
                Write-Warning 'Group name not found, run without parameters to get list of group names'
            }
        }
        # MemberName param set

        if ($memberName)
        {
            foreach ($group in $groupraw) 
            {
                [string[]]$members = $group.'member names' -replace ' ', '' -split ','
                foreach ($m in $members) 
                {
                    if ($m -like $memberName) 
                    {
                        "User " + $m + " is member of " + "GroupName: " + $group.'group name'
                    }
                }
            }
        }

        # Ausgabe der Daten wenn keine Parameter angegeben werden
        if ((!($groupName)) -and (!($membername))) 
        {
            return $groupraw
        }

    }
}

<#
.SYNOPSIS
    Read satistics information from the SEPPmail Appliance
.DESCRIPTION
    SEPPmail provides statistic data via the API for reporting purposes.
.EXAMPLE
    PS C:\> Get-SLStatsInfo
    Get all statistics data (i.e. for daily reports)
.EXAMPLE
    PS C:\> Get-SLStatsInfo -type user | Where-Object emailAddress -like 'internal.user@contoso.de'
    Get (sending) user-based status info only
.EXAMPLE
    PS C:\> Get-SLStatsInfo -type domain|Where-Object domainname -like mustermann.com
    Get (sending) domain-based status info only
#>

function Get-SLStatsInfo
{
    [CmdletBinding()]
    param(

        [Parameter(
            Mandatory = $false,
            HelpMessage = 'Get user or domain statistics'
        )]
        [ValidateSet('user', 'domain')]
        [string]$type = 'user',

        [Parameter(
            Mandatory = $false,
            HelpMessage = 'Rebuild cached stats info database'
        )]
        [switch]$rebuild = $false
    )

    begin
    {
        Set-SLConfig | Out-Null | Out-Null
    }

    process 
    {
        try {
        $urlroot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
            if ($rebuild)
            {
                $uribase = $urlroot + 'statistics' + '?' + 'returnType' + '=' + 'CSV' + '&rebuildList'
            }
            else 
            {
                $uribase = $urlroot + 'statistics' + '?' + 'returnType' + '=' + 'CSV'
            }

            if ($type -like 'user') 
            {
                $uri = $uribase + '&statisticsType=user'
                $userStatsRaw = Invoke-RestMethod -Uri $uri -Method GET -Credential $SLConfig.secret | ConvertFrom-Csv -Delimiter ';'
                $userStatsRaw.'accountLastUsed'
                $userArray = @()
                $userArray = $userStatsRaw | ForEach-Object `
                {
                [ordered]@{
                    'emailAddress'                  = [string]$_.'E-mail address'
                    'userId'                        = if ((!($_.'User ID'))) { 'none' } else { [String]$_.'User ID' }
                    #'userId' = $_.'User ID'
                    'accountLastUsed'               = if (!($_.'Account last used')) { 'none' } else { [DateTime]$_.'Account last used' }
                    'noEnc'                         = if (($_.'May not encrypt mails').Length -eq '0') { $true } else { $false }
                    'noDec'                         = if (($_.'May not decrypt mails').Length -eq '0') { $true } else { $false }
                    'noSig'                         = if (($_.'May not sign mails').Length -eq '0') { $true } else { $false }
                    'groupMembership'               = [String[]]$_.'Group membership'
                    'regUser'                       = if ($_.'Registered user' -eq '0') { $false } else { $true }
                    'usesLicense'                   = if ($_.'Uses License' -eq '0') { $false } else { $true }
                    'certificateExpiresOn'          = if (($_.'Certificate expires on').Length -eq '0') { 'no expiration date set' } else { [DateTime]$_.'Certificate expires on' }
                    'smimeEncMailsSent'             = [int]$_.'S/MIME encrypted mails sent'
                    'smimeEncMailsReceived'         = [int]$_.'S/MIME encrypted mails received'
                    'smimeSigMailsSent'             = [int]$_.'S/MIME signed mails sent'
                    'smimeSigMailsReceived'         = [int]$_.'S/MIME signed mails received'
                    'openPGPEncMailsSent'           = [int]$_.'openPGP encrypted mails sent'
                    'openPGPEncMailsReceived'       = [int]$_.'openPGP encrypted mails received'
                    'ginaEncMailsSent'              = [int]$_.'GINA encrypted mails sent'
                    'ginaEncMailsReceived'          = [int]$_.'GINA encrypted mails received'
                    'smimeDomainEncMailsSent'       = [int]$_.'S/MIME Domain encrypted mails sent'
                    'smimeDomainEncMailsReceived'   = [int]$_.'S/MIME Domain encrypted mails received'
                    'openPGPDomainEncMailsSent'     = [int]$_.'openPGP Domain encrypted mails sent'
                    'openPGPDomainEncMailsReceived' = [int]$_.'openPGP Domain encrypted mails received'
                    'hinDomainEncMailsSent'         = [int]$_.'HIN Domain encrypted mails sent'
                    'hinDomainEncMailsReceived'     = [int]$_.'HIN domain encrypted mails received'
                    'mailsReroutedToIncamail'       = [int]$_.'Mails rerouted to Incamail'
                }
                }
                return $userArray | ForEach-Object { [pscustomobject]$_ }
            }
            if ($type -like 'domain') 
            {
            $uri = $uribase + '&statisticsType=domain'
            $domStatsRaw = Invoke-RestMethod -Uri $uri -Method GET -Credential $SLConfig.secret | ConvertFrom-Csv -Delimiter ';'
            Write-Verbose "Creating output Hashtables"
            $domArray = @()
            $domArray = $domstatsraw | ForEach-Object `
            {
                [ordered]@{
                    'domainName'                    = [string]$_.'Domain Name'
                    'smimeEncMailsSent'             = [int]$_.'S/MIME encrypted mails sent'
                    'smimeEncMailsReceived'         = [int]$_.'S/MIME encrypted mails received'
                    'smimeSignedMailsSent'          = [int]$_.'S/MIME signed mails sent'
                    'smimeSignedMailsReceived'      = [int]$_.'S/MIME signed mails received'
                    'openPGPEncMailsSent'           = [int]$_.'openPGP encrypted mails sent'
                    'openPGPEncMailsReceived'       = [int]$_.'openPGP encrypted mails received'
                    'ginaEncMailsSent'              = [int]$_.'GINA encrypted mails sent'
                    'ginaEncMailsReceived'          = [int]$_.'GINA encrypted mails received'
                    'smimeDomainEncMailsSent'       = [int]$_.'S/MIME Domain encrypted mails sent'
                    'smimeDomainEncMailsReceived'   = [int]$_.'S/MIME Domain encrypted mails received'
                    'openPGPDomainEncMailsSent'     = [int]$_.'openPGP Domain encrypted mails sent'
                    'openPGPDomainEncMailsReceived' = [int]$_.'openPGP Domain encrypted mails received'
                    'hinDomainEncMailsSent'         = [int]$_.'HIN Domain encrypted mails sent'
                    'hinDomainEncMailsReceived'     = [int]$_.'HIN domain encrypted mails received'
                    'mailsReroutedToIncamail'       = [int]$_.'Mails rerouted to Incamail'
                }
            }
            return $domArray | ForEach-Object { [pscustomobject]$_ }
            }
        } catch {
            Write-Error "Request to SEPPmail appliance failed with exception: $($_.Exception)"
        }
    }
}

<#
.SYNOPSIS
    Read information about encryption for domains and users
.DESCRIPTION
    SEPPmail stores information which encryption capabilities are available for an external recipient. The CmdLet
    can retrieve this data.
    This CmdLets support the `-rebuild` parameter to get current infos of the statistics database.
    The CmdLet has three operation modes (ParameterSets), personal, domain and EMailAddress.
.EXAMPLE
    PS C:\> Get-SLEncInfo -personal -encModePer SMIME
    Show external recipients having SMIME as encryption method
.EXAMPLE
    PS C:\> Get-SLEncInfo -personal -encModePer PGP
    Show external recipients having PGP as encryption method
.EXAMPLE
    PS C:\> Get-SLEncInfo -personal -encModePer GINA|Where-Object status -ne 'enabled'
    Show external recipients having GINA as encryption method
.EXAMPLE
    PS C:\> Get-SLEncInfo -domain -encModeDom SMIME
    Show external domains have SMIME as encryption method
.EXAMPLE
    PS C:\> Get-SLEncInfo -eMailAddress max@mustermann.com
    Find out what encryption methods are possible for an external recipient
#>

function Get-SLEncInfo
{
    [CmdletBinding()]
    param (
        # Param block personal
        [Parameter(
            ParameterSetName = 'personal',
            Mandatory = $true,
            HelpMessage = 'Restrict to smtp-address-based encryption info'
        )]
        [switch]$personal,
        
        [Parameter(
            ParameterSetName = 'personal',
            Mandatory = $true,
            HelpMessage = 'Filter output to a specific encryption method'
        )]
        [ValidateSet('SMIME', 'PGP', 'GINA')]
        [Alias('encp')]
        [String]$encModePer,

        # Param block domain
        [Parameter(
            ParameterSetName = 'domain',
            Mandatory = $true,
            HelpMessage = 'Restrict to eMail-domain-based encryption info'
        )]
        [switch]$domain,
            
        [Parameter(
            ParameterSetName = 'domain',
            Mandatory = $true,
            HelpMessage = 'Filter output to a specific encryption method'
        )]
        [ValidateSet('SMIME', 'PGP', 'HIN', 'TLS')]
        [Alias('encd')]
        [String]$encModeDom,
                
        # param Block used in 'eMail' and multiple paramsets
        [Parameter(
            ParameterSetName = 'personal',
            Mandatory = $false,
            HelpMessage = 'Define a specific eMail adress'
        )]
        [Parameter(
            ParameterSetName = 'eMail',
            Mandatory = $true,
            HelpMessage = 'Define a specific eMail adress'
        )]
        [ValidatePattern('([a-z0-9][-a-z0-9_\+\.]*[a-z0-9])@([a-z0-9][-a-z0-9\.]*[a-z0-9]\.(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|([0-9]{1,3}\.{3}[0-9]{1,3}))')]
        [Alias('eMail')]
        [string]$eMailAddress,

        [Parameter(
            ParameterSetName = 'personal',
            Mandatory = $false,
            HelpMessage = 'Rebuild cached encryption info database'
        )]
        [Parameter(
            ParameterSetName = 'domain',
            Mandatory = $false,
            HelpMessage = 'Rebuild cached encryption info database'
        )]
        [Parameter(
            ParameterSetName = 'eMail',
            Mandatory = $false,
            HelpMessage = 'Rebuild cached encryption info database'
        )]
        [switch]$rebuild = $false

    )
    
    begin
    {
        Set-SLConfig | Out-Null
        $urlroot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
    }
    
    process
    {
        try {
            if ($PSCmdlet.ParameterSetName -eq 'personal') 
            {
            #$uri = "{0}{1}{2}/personal{3}{4}" -f $urlroot, 'encinfo', ($encModePer ? '/' + $encModePer.ToUpper():$null), ($eMailAddress ? '?mailAddress=' + $eMailAddress.ToLower():$null), ($rebuild ? '?rebuildList=1':$null)
            
            Write-Verbose 'Constructing personal parameterset'
            $encModePerParam = if ($encModePer) { '/' + "$($encModePer.ToUpper())" } else { $null }
            $eMailParam = if ($eMailAddress) { '?mailAddress=' + "$($eMailAddress.ToLower())" } else { $null }
            $rebuildParam = if ($rebuild) { '?rebuildList=1' } else { $null }
            
            Write-Verbose "passing encModeParam: $EncModePerParam, eMailParam: $eMailParam, rebuildParam: $rebuildParam"
            $uri = "{0}{1}{2}/personal{3}{4}" -f $urlroot, 'encinfo', $encModeParam, $eMailParam, $rebuildParam
            Write-Verbose "Final URI: $URI"
            }
            elseif ($PSCmdlet.ParameterSetName -eq 'domain')
            {
            #$uri = "{0}{1}{2}/domain{3}" -f $urlroot, 'encinfo', ($encModeDom ? '/' + $encModeDom.ToUpper():$null), ($rebuild ? '?rebuildList=1':$null)
            
            Write-Verbose 'Constructing domain parameterset'
            $encModeDomParam = if ($encModeDom) { '/' + "$($encModeDom.ToUpper())" } else { $null }
            $rebuildParam = if ($rebuild) { '?rebuildList=1' } else { $null }            
            
            Write-Verbose "passing encModeParam: $EncModeParam, eMailParam: $eMailParam, rebuildParam: $rebuildParam"
            $uri = "{0}{1}{2}/domain{3}" -f $urlroot, 'encinfo', $encModeDomParam, $rebuildParam
            Write-Verbose "Final URI: $URI"
            }
            elseif ($PSCmdlet.ParameterSetName -eq 'eMail')
            {
            $uri = "{0}{1}/?mailAddress={2}" -f $urlroot, 'encinfo', $eMailAddress
            }
            $rawdata = Invoke-RestMethod -Uri $uri -Method GET -Credential $SLConfig.secret
            switch ($PSCmdlet.ParameterSetname) 
            {
            personal
            {
                Switch ($encModePer)
                {
                    SMIME { return $rawdata.smime.personal }
                    PGP { return $rawdata.pgp.personal }
                    GINA { return $rawdata.gina.personal }
                }
            }
            domain
            {
                switch ($encModeDom)
                {
                    SMIME { return $rawdata.smime.domain }
                    PGP { return $rawdata.pgp.domain }
                    HIN { return $rawdata.hin.domain }
                    TLS { return $rawdata.tls.domain }
                }
            }
            eMail 
            {
                $returndata = New-Object -TypeName PSObject
                if ($rawdata.smime.domain.domain) { $returndata | Add-Member -MemberType Noteproperty -Name SMIMEdomain -Value $rawdata.smime.domain.domain }
                if ($rawdata.smime.personal.status) { $returndata | Add-Member -MemberType Noteproperty -Name SMIMEpersonal -Value $rawdata.smime.personal.status }
                if ($rawdata.pgp.domain.domain) { $returndata | Add-Member -MemberType Noteproperty -Name PGPdomain -Value $rawdata.pgp.domain.domain }
                if ($rawdata.pgp.personal.status) { $returndata | Add-Member -MemberType Noteproperty -Name PGPdomain -Value $rawdata.pgp.personal.status }
                if ($rawdata.hin.domain.domain) { $returndata | Add-Member -MemberType Noteproperty -Name HINdomain -Value $rawdata.hin.domain.domain }
                if ($rawdata.tls.domain.domain) { $returndata | Add-Member -MemberType Noteproperty -Name TLSdomain -Value $rawdata.tls.domain.domain }
                if ($rawdata.gina.personal.status) { $returndata | Add-Member -MemberType Noteproperty -Name GINAperonal -Value $rawdata.gina.personal.status }
                return $returndata
            }
            }
        } catch {
            Write-Error "Request to SEPPmail appliance failed with exception $($_.Exception)"
        }
    }
    end
    {
        
    }
}

<#
.SYNOPSIS
    Create a GINA-User
.DESCRIPTION
    This PS Module allows you to create and modify GINA Users.
    This avoids the registration process for external recipients
    and allows the usage of known passwords for the user
    (i.e. an invoice Number, social security number or similar)
    and the mobile number to communicate via a second channel.
.EXAMPLE
    PS C:\> New-SLGINAUser -userName 'Max Mustermann' -eMailAddress max.mustermann@test.co -oneTimePw 'hZ76$59' -mobile '+49123456789'
    To create a new GINA user use the CmdLet as above.
.EXAMPLE
    PS C:\> Import-Csv .\examples\NewGINAUsers.csv|New-SLGINAUser
    Use a CSV File (see examples folder) to bulk-create GINA Users.
#>

function New-SLGinaUser
{
    [CmdletBinding()]
    param (
        [Parameter(
            Mandatory                       = $true,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user eMail address'
            )]
        [ValidatePattern('([a-z0-9][-a-z0-9_\+\.]*[a-z0-9])@([a-z0-9][-a-z0-9\.]*[a-z0-9]\.(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|([0-9]{1,3}\.{3}[0-9]{1,3}))')]
        [Alias('email')]
        [string]$eMailAddress,

        [Parameter(
            Mandatory                       = $true,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user full name'
        )]
        [Alias('user')]
        [string]$userName,

        [Parameter(
            Mandatory                       = $true,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user password as string'
            )]
        [Alias('password')]
        [string]$Pwd,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user mobile number including country code'
            )]
        [ValidatePattern('^([+](\d{1,3})\s?)?((\(\d{3,5}\)|\d{3,5})(\s)?)\d{3,8}$')]
        [string]$mobile,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = "GINA user `'expired`' setting 0 or 1"
            )]
        [ValidateSet('0','1')]
        [string]$expired = '0',

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user passwort reset question'
            )]
        [string]$question,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user passwort reset answer'
            )]
        [string]$answer,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'For MSP´s and multi-customer environments, set the GINA users customer'
            )]
        [string]$customer
    )
    begin
    {
        try {
            Set-SLConfig | Out-Null
        }
        catch {
            Write-error "Could not load configuration with set-SLConfig"
            Write-Error $_
        }
    }
    process {
        try {
            $urlRoot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
            $uri = $urlRoot + 'newginauser'
            # V1.1 $uri = $urlRoot + 'ginauser/new'
            $userData = [ordered]@{
                email    = $eMailAddress
                password = $pwd
                name     = $userName
                mobile   = $mobile
                expired  = $expired
                question = $question
                answer   = $answer
                customer = $customer
            } | ConvertTo-Json

            $invokeParam = @{
                Uri         = $uri 
                Method      = 'POST '
                Credential  = $SLConfig.secret
                ContentType = "application/json"
                body        = $userData
            }
            Write-Verbose "Creating new GINA User $userName with E-mailAdress $eMailAddress"
            $NewGinaUser = Invoke-RestMethod @invokeParam
            Write-Verbose "ErrorCode $($NewGinaUser.ErrorCode)"
            if (!($($NewGinaUser.errorCode))) {
                return $NewGinaUser.message
            }
            else {
                Write-Error "SEPPmail returned Error $($newGinaUser.errorCode): $($NewGinaUser.ErrorMessage)"
            } 
        } catch {
            Write-Error "Request to SEPPmail failes with exception $($_.Exception)"
            }
    }
    end
    {
        
    }
}

<#
.SYNOPSIS
    Update GINA Users properties
.DESCRIPTION
    This CmdLet lets you modify and add additional properties on GINA Users.
    This CmdLet is also pipeline-aware.
.EXAMPLE
    PS C:\> Set-SLGINAUser -eMailAddress 'alice.miller@contoso.com' -answer 'Red'
    Update a single property of a GINA User
.EXAMPLE
    PS C:\> Import-Csv .\examples\UpdateGINAUsers.csv|Set-SLGINAUser
    Mass-update GINA Users
#>

function Set-SLGinaUser
{
    [CmdletBinding(SupportsShouldProcess)]
    param (
        [Parameter(
            Mandatory                       = $true,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user eMail adress'
            )]
        [ValidatePattern('([a-z0-9][-a-z0-9_\+\.]*[a-z0-9])@([a-z0-9][-a-z0-9\.]*[a-z0-9]\.(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|([0-9]{1,3}\.{3}[0-9]{1,3}))')]
        [Alias('email')]
        [string]$eMailAddress,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user full name'
            )]
        [Alias('user')]
        [string]$userName,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user password as string'
            )]
        [Alias('password')]
        [string]$pwd,
        
        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user mobile number including country code, i.e. +4911122233344'
            )]
        [ValidatePattern('^([+](\d{1,3})\s?)?((\(\d{3,5}\)|\d{3,5})(\s)?)\d{3,8}$')]    
        [string]$mobile,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = "GINA user `'language`' setting e or d"
            )]
        [ValidateSet('e','d')]    
        [string]$language = 'd',

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = "GINA user `'expired`' setting 0 or 1"
            )]
        [ValidateSet('0','1')]
        [string]$expired,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user passwort reset question'
            )]
        [string]$question,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user passwort reset answer'
            )]
        [string]$answer,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'For MSP´s and multi-customer environments, set the GINA users customer'
            )]
        [string]$customer,            

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = "GINA user `'ZIP attachment`' setting"
            )]
        [ValidateSet('0','1')]    
        [string]$zip_attachment,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = "GINA user `'created by`' information"
            )]
        [string]$creator
    )
    
    begin
    {
        try {
            Set-SLConfig | Out-Null
        }
        catch {
            Write-error "Could not load configuration with Set-SLConfig"
            Write-Error "$error"
        }
    }
    
    process
    {
        try {
            $urlRoot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort
            $uri = $urlRoot + 'modifyginauser'
            # V1.1 $uri = $urlRoot + 'ginauser/set'
            $userData = [ordered]@{
                email          = $eMailAddress
                name           = $userName
                customer       = $customer
                language       = $language
                password       = $password
                mobile         = $mobile
                zip_attachment = $zip_attachment
                question       = $question
                answer         = $answer
                creator        = $creator
                expired        = $expired
            } | ConvertTo-Json

            $invokeParam = @{
                Uri         = $uri 
                Method      = 'POST '
                Credential  = $SLConfig.secret
                ContentType = "application/json"
                body        = $userData
            }
            Write-Verbose "Modifying GINA User $EMailAddress using URL $uri"
            if ($PSCmdLet.ShouldProcess($($userdata.eMailAddress),'Update GINA User')) {
                $SetGinaUser = Invoke-RestMethod @invokeParam
                Write-Verbose "ErrorCode $($SetGinaUser.ErrorCode)"
                if (!($($SETGinaUser.errorCode))) {
                    return $SetGinaUser.message
                }
            }
            else {
                Write-Error "SEPPmail returned Error $($SetGinaUser.errorCode): $($SetGinaUser.ErrorMessage)"
            }
        }
        catch {
                Write-Error "An error occured, see $error"
        }
    }
    end
    {
        if ($SetGinaUser) {return $SetGinaUser}
    }
}

<#
.SYNOPSIS
    Get a GINA Users properties
.DESCRIPTION
    This CmdLet lets youread properties on an existing GINA User.
    This CmdLet is also pipeline-aware.
.EXAMPLE
    PS C:\> Get-SLGINAUser
    Get all GINA Users
.EXAMPLE
    PS C:\> Get-SLGINAUser -eMailAddress 'alice.miller@contoso.com'
    Get information about a GINA User
.EXAMPLE
    PS C:\> Import-Csv .\examples\UpdateGINAUsers.csv|Get-SLGINAUser
    Mass-receive GINA Users (test if they exist)
#>

function Get-SLGinaUser
{
    [CmdletBinding(SupportsShouldProcess)]
    param (
        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user eMail adress'
            )]
        [ValidatePattern('([a-z0-9][-a-z0-9_\+\.]*[a-z0-9])@([a-z0-9][-a-z0-9\.]*[a-z0-9]\.(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|([0-9]{1,3}\.{3}[0-9]{1,3}))')]
        [Alias('email')]
        [string]$eMailAddress,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user full name'
            )]
        [Alias('user')]
        [string]$userName,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'GINA user mobile number including country code, i.e. +4911122233344 or 004911122233344'
            )]
        [ValidatePattern('^([+](\d{1,3})\s?)?((\(\d{3,5}\)|\d{3,5})(\s)?)\d{3,8}$')]    
        [string]$mobile,

        [Parameter(
            Mandatory                       = $false,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage                     = 'For MSP´s and multi-customer environments, set the GINA users customer'
            )]
        [string]$customer

    )
    
    begin
    {
        try {
            Set-SLConfig | Out-Null
        }
        catch {
            Write-error "Could not load configuration with Set-SLConfig"
            Write-Error "$error"
        }
    }
    
    process
    {
        try {
            $urlRoot = New-SLUrlRoot -FQDN $SLConfig.SEPPmailFQDN -adminPort $SLConfig.adminPort

            Write-Verbose "Passing eMailAddress: $eMailAddress, userName: $userName, mobile: $mobile, customer: $customer"
            #############################
            $uri = "{0}{1}{2}{3}{4}{5}" -f $urlroot, 'ginauser/get', $eMailAddress, $userName, $mobile, $customer
            #############################
            $invokeParam = @{
                Uri         = $uri 
                Method      = 'GET'
                Credential  = $SLConfig.secret
                ContentType = "application/json"
            }
            Write-Verbose "Receiving GINA Users using URL $uri"
            if ($PSCmdLet.ShouldProcess($uri,'Get GINA User')) {
                $GetGinaUser = Invoke-RestMethod @invokeParam
                Write-Verbose "ErrorCode $($SetGinaUser.ErrorCode)"
                if (!($($GetGinaUser.errorCode))) {
                    return $GetGinaUser.message
                }
            }
            else {
                Write-Error "SEPPmail returned error $($SetGinaUser.errorCode): $($SetGinaUser.ErrorMessage)"
            }
        }
        catch {
                Write-Error "An error occured, see $error"
        }
    }
    end
    {
        if ($GetGinaUser) {return $GetGinaUser}
    }
}
# SIG # Begin signature block
# MIIL1wYJKoZIhvcNAQcCoIILyDCCC8QCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUpDRe922PcItDHrO+QA5dZv1T
# HMGggglAMIIEmTCCA4GgAwIBAgIQcaC3NpXdsa/COyuaGO5UyzANBgkqhkiG9w0B
# AQsFADCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYG
# A1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
# KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkx
# HzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMTMxMjEwMDAwMDAw
# WhcNMjMxMjA5MjM1OTU5WjBMMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl
# LCBJbmMuMSYwJAYDVQQDEx10aGF3dGUgU0hBMjU2IENvZGUgU2lnbmluZyBDQTCC
# ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJtVAkwXBenQZsP8KK3TwP7v
# 4Ol+1B72qhuRRv31Fu2YB1P6uocbfZ4fASerudJ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