Sample/MIMPAMDSC_Sample.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
Configuration MIMDSC
{
    Import-DscResource -ModuleName xMimDsc
    $computername = "MIMPamComputerName"
    Node $computername
    {
        xMIMSvc MIMSvc
        {
            Ensure = "Present"
            SetupFiles =  "\\sharedLocation\Service and Portal\Service and Portal.msi"
            ProductId = "----PRODUCT ID----"
            ServiceServer = $computername
            SQLServerInstance = $computername
            SQLServerDB = "FimService"
            SyncServer = $computername
            SyncServiceAccount = $AllNodes.SyncAccount
            UseExistingDatabase = 1
            MimSvcAccount = $AllNodes.ServiceAccount
            EmailSvcAccount = $AllNodes.EmailAccount
            MailServer = "outlook.office.365.com"
            ServiceAddress = $computername
            PsDscRunAsCredential = $AllNodes.RunAs
        }

        
        xMIMSvcHotfix "MimSvcHotfix"
        {
            Ensure = "Present"
            MspFileSource = "\\sharedLocation\Service and Portal\Hotfix\MIMService_x64_KB4469694.msp"
            VersionToUpdate = "4.5.286.0"
            PsDscRunAsCredential = $AllNodes.RunAs
            DependsOn = "[xMIMSvc]MIMSvc"
        }

        xMIMSvcSwitchToGmsa "MIMSvcSwitchToGmsa"
        {
            CurrentServiceAccount = $AllNodes.ServiceAccount
            EmailSvcAccount = $AllNodes.EmailAccount
            Ensure = "Present"
            MIMSvcGmsaAccount = "Domain\svcGmsaAccount$"
            ServiceAddress = $computername
            SetupFiles = "\\sharedLocation\Service and Portal\Service and Portal.msi"
            DependsOn = "[xMIMSvcHotfix]MimSvcHotfix"
            PsDscRunAsCredential = $AllNodes.RunAs
        }

        xMIMPamInstall "MIMPAM"
        {
            EmailSvcAccount = $AllNodes.EmailAccount
            Ensure = "Present"
            PAMCompGmsaAccount = "Domain\ComponentServiceGmsa$"
            PAMMonGmsaAccount = "Domain\MonitoringServiceGmsa$"
            PAMWebPoolGmsaAccount = "Domain\IISAppPoolGmsa$"
            ServiceAddress = $computername
            SetupFiles = "\\SharedLocation\Service and Portal\Service and Portal.msi"
            PsDscRunAsCredential = $AllNodes.RunAs
            DependsOn = "[xMIMSvcSwitchToGmsa]MIMSvcSwitchToGmsa"
        }
    }
}

$cd = @{
    AllNodes = @(
        @{
            NodeName = "MIMPamComputerName"
            PSDscAllowPlainTextPassword = $true
            PsDscAllowDomainUser = $true
            RunAs = New-Object System.Management.Automation.PSCredential ("Domain\AdminAccount", (ConvertTo-SecureString "Password" -AsPlainText -Force))
            ServiceAccount = New-Object System.Management.Automation.PSCredential ("Domain\MimServiceAccount", (ConvertTo-SecureString "Password" -AsPlainText -Force))
            EmailAccount = New-Object System.Management.Automation.PSCredential ("Office365 Email account UPN", (ConvertTo-SecureString "Password" -AsPlainText -Force))
            SyncAccount = "Domain\ManagementAgentSvcAccount"
        }
    )
}

MIMDSC -ConfigurationData $cd