Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.13 KB | None | 0 0
  1. <#
  2. Name : Add-MBAM-Databases.ps1
  3. Version : 1.0
  4. Author : Henrik Rading, CT Global A/S
  5. Date : 2017-01-17
  6. Command : powershell.exe -executionpolicy bypass -file Add-MBAM-Databases.ps1
  7. Arguments : <n/a>
  8. Purpose : Creates MBAM databases on SQL server. can be run from any server with the MBAMServerSetup
  9. and SQL Server ScriptDom installed.
  10. #>
  11.  
  12.  
  13. # *** UPDATE THESE VARIABLES TO MATCH ENVIRONMENT ***
  14.  
  15. #Enter the fqdn and port of the SQL server (port is only needed if port is different from 1433).
  16. $databaseServer = 'sql1.viamonstra.com,1433'
  17.  
  18. #Name of the Recovery and Hardware database that is created.
  19. $RecoveryDBName = 'MBAM Recovery and Hardware'
  20.  
  21. #Name of the Compliance database that is created.
  22. $ComplianceDBName = 'MBAM Compliance Status'
  23.  
  24. #Name of the Active Directory group created for the "MBAM DataBase Read Write" group. In <domain>\<groupname> format.
  25. $GroupDataBaseRW = 'VIAMONSTRA\MBAM-DB Access Read_write'
  26.  
  27. #Name of the Active Directory group created for the "MBAM DataBase Read Only" group. In <domain>\<groupname> format.
  28. $GroupDataBaseRO = 'VIAMONSTRA\MBAM-DB Access Read_only'
  29.  
  30. # *** END OF USER VARIABLES, DO NOT MODIFY SCRIPT AFTER THIS LINE! ***
  31.  
  32. #Enable Recovery database
  33. Enable-MbamDatabase -AccessAccount $GroupDataBaseRW -Recovery `
  34. -ConnectionString "Data Source=$($databaseServer);Integrated Security=True" -DatabaseName $RecoveryDBName
  35.  
  36. #Enable compliance and audit database
  37. Enable-MbamDatabase -AccessAccount $GroupDataBaseRW -ComplianceAndAudit `
  38. -ConnectionString "Data Source=$($databaseServer);Integrated Security=True" -DatabaseName $ComplianceDBName `
  39. -ReportAccount $GroupDataBaseRO
  40.  
  41.  
  42.  
  43.  
  44. <#
  45. Name : Add-MBAM-Reports-and-CMintegration.ps1
  46. Version : 1.0
  47. Author : Henrik Rading, CT Global A/S
  48. Date : 2017-01-17
  49. Command : powershell.exe -executionpolicy bypass -file Add-MBAM-Reports-and-CMintegration.ps1
  50. Arguments : <n/a>
  51. Purpose : Creates MBAM reports on SQL Server Reporting Server and creates Configuration Manager items.
  52. The script must be run from the ConfigMgr Primary Site server with the MBAMServerSetup installed.
  53. #>
  54.  
  55.  
  56. # *** UPDATE THESE VARIABLES TO MATCH ENVIRONMENT ***
  57.  
  58. #Name of the MBAM Compliance and Audit Database service account created in AD. Use <domain>\<groupname> format.
  59. $username = "VIAMONSTRA\MBAM-SVC-CA"
  60.  
  61. #Password of the service account in clear text. remove this from script after execution
  62. # or change script to prompt for credentials.
  63. $password = 'MySecretPassword'
  64.  
  65. #Name of the Active Directory group created for the "MBAM Audit Report". Use <domain>\<groupname> format.
  66. $ReadOnlyAccessGroup = 'VIAMONSTRA\MBAM-Role Audit Report Users'
  67.  
  68. #Enter the fqdn and port of the SQL server (port is only needed if port is different from 1433).
  69. $databaseServer = 'sql1.viamonstra.com,1433'
  70.  
  71. #Name of the Recovery and Hardware database that is created.
  72. $RecoveryDBName = 'MBAM Recovery and Hardware'
  73.  
  74. #Name of the Compliance database that is created.
  75. $ComplianceDBName = 'MBAM Compliance Status'
  76.  
  77. # *** END OF USER VARIABLES, DO NOT MODIFY SCRIPT AFTER THIS LINE! ***
  78.  
  79. $password = $password | ConvertTo-SecureString -asPlainText -Force
  80. $credential = New-Object System.Management.Automation.PSCredential($username,$password)
  81.  
  82. # Enable report feature
  83. Enable-MbamReport -ComplianceAndAuditDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($ComplianceDBName)';Integrated Security=True" `
  84. -ComplianceAndAuditDBCredential $credential -ReportsReadOnlyAccessGroup $ReadOnlyAccessGroup
  85.  
  86. # Enable System Center Configuration Manager integration feature
  87. Enable-MbamCMIntegration
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. <#
  96. Name : Add-MBAM-Websites.ps1
  97. Version : 1.0
  98. Author : Henrik Rading, CT Global A/S
  99. Date : 2017-01-17
  100. Command : powershell.exe -executionpolicy bypass -file Add-MBAM-Websites.ps1
  101. Arguments : <n/a>
  102. Purpose : Installs MBAM websites to IIS and configures SSL certificate and application pools.
  103. The script must be run from the MBAM IIS server with the MBAMServerSetup installed.
  104. #>
  105.  
  106.  
  107. # *** UPDATE THESE VARIABLES TO MATCH ENVIRONMENT ***
  108.  
  109. #Webservice credentials
  110. #Name of the MBAM Web Application Pool service account created in AD. Use <domain>\<groupname> format.
  111. $wsusername = "VIAMONSTRA\MBAM-SVC-AppPool"
  112.  
  113. #Password of the service account in clear text. remove this from script after execution
  114. #or change script to prompt for credentials.
  115. $wspassword = 'MySecretPassword'
  116.  
  117. #Name of the Active Directory group created for the "MBAM HelpDesk Users". Use <domain>\<groupname> format.
  118. $GroupHelpdesk = 'VIAMONSTRA\MBAM-Role HelpDesk Users'
  119.  
  120. #Name of the Active Directory group created for the "MBAM Advanced HelpDesk Users". Use <domain>\<groupname> format.
  121. $GroupAdvancedHelpdesk = 'VIAMONSTRA\MBAM-Role Advanced HelpDesk Users'
  122.  
  123. #Name of the Active Directory group created for the "MBAM Compliance Report Users". Use <domain>\<groupname> format.
  124. $GroupComplianceReport = 'VIAMONSTRA\MBAM-Role Compliance Report Users'
  125.  
  126. #Name of the organzation as it should appear on the Self Service Portal.
  127. $CompanyName = 'ViaMonstra Inc.'
  128.  
  129. #Name of the DNS alias created and used for the web server certificate.
  130. $hostname = 'mbam.viamonstra.com'
  131.  
  132. #Enter the fqdn and port of the SQL server (port is only needed if port is different from 1433).
  133. $databaseServer = 'sql1.viamonstra.com,1433'
  134.  
  135. #Name of the Recovery and Hardware database that is created.
  136. $RecoveryDBName = 'MBAM Recovery and Hardware'
  137.  
  138. #Name of the Compliance database that is created.
  139. $ComplianceDBName = 'MBAM Compliance Status'
  140.  
  141. #url to the SQL Server Report Server on the ConfigMgr server. in the format http(s)://<server fqdn>/reportserver
  142. $ReportUrl = 'http://cm1.viamonstra.com/reportserver'
  143.  
  144. # *** END OF USER VARIABLES, DO NOT MODIFY SCRIPT AFTER THIS LINE! ***
  145.  
  146.  
  147. $wspassword = $wspassword | ConvertTo-SecureString -asPlainText -Force
  148. $wscredential = New-Object System.Management.Automation.PSCredential($wsusername,$wspassword)
  149.  
  150. $Cert=Get-ChildItem cert:\LocalMachine\My | Where-Object {$_.Subject -like "*$($hostname)*"}
  151.  
  152. # Enable agent service feature
  153. Enable-MbamWebApplication -AgentService -Certificate $Cert `
  154. -ComplianceAndAuditDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($ComplianceDBName)';Integrated Security=True" `
  155. -DataMigrationAccessGroup $GroupDataMigration -HostName $hostname -InstallationPath 'C:\inetpub' -Port 443 `
  156. -RecoveryDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($RecoveryDBName)';Integrated Security=True" `
  157. -WebServiceApplicationPoolCredential $wscredential
  158.  
  159. # Enable administration web portal feature
  160. Enable-MbamWebApplication -AdministrationPortal -AdvancedHelpdeskAccessGroup $GroupAdvancedHelpdesk -Certificate $Cert `
  161. -ComplianceAndAuditDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($ComplianceDBName)';Integrated Security=True" `
  162. -HelpdeskAccessGroup $GroupHelpdesk -HostName $hostname -InstallationPath 'C:\inetpub' -Port 443 `
  163. -RecoveryDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($RecoveryDBName)';Integrated Security=True" `
  164. -ReportsReadOnlyAccessGroup $GroupComplianceReport -ReportUrl $ReportUrl -VirtualDirectory 'HelpDesk' `
  165. -WebServiceApplicationPoolCredential $wscredential
  166.  
  167. # Enable self service web portal feature
  168. Enable-MbamWebApplication -Certificate $Cert -CompanyName $CompanyName `
  169. -ComplianceAndAuditDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($ComplianceDBName)';Integrated Security=True" `
  170. -DisableNoticePage -HelpdeskUrlText 'Contact Helpdesk or IT department.' -HostName $hostname `
  171. -InstallationPath 'C:\inetpub' -Port 443 `
  172. -RecoveryDBConnectionString "Data Source=$($databaseServer);Initial Catalog='$($RecoveryDBName)';Integrated Security=True" `
  173. -SelfServicePortal -VirtualDirectory 'SelfService' -WebServiceApplicationPoolCredential $wscredential
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement