forked from MasayukiOzawa/SQLServer-Util
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1f3bf3
commit b5f9769
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# https://github.com/PowerShell/xSQLServer | ||
# C:\Program Files\WindowsPowerShell\Modules に DSC Resource を配置 | ||
|
||
if(!(Test-Path (Join-Path $ENV:ProgramFiles "WindowsPowerShell\Modules\xSQLServer\ja-jp"))){ | ||
Copy-Item (Join-Path $ENV:ProgramFiles "WindowsPowerShell\Modules\xSQLServer\en-us") (Join-Path $ENV:ProgramFiles "WindowsPowerShell\Modules\xSQLServer\ja-jp") -Recurse | ||
} | ||
$Password = "M@sterEr0s" | ||
|
||
Configuration LCM | ||
{ | ||
LocalConfigurationManager | ||
{ | ||
AllowModuleOverwrite = $true | ||
DebugMode = "ForceModuleImport" | ||
RebootNodeIfNeeded = $true | ||
} | ||
} | ||
|
||
Configuration SQLServer | ||
{ | ||
Import-DscResource -Module xSQLServer | ||
|
||
Node $AllNodes.NodeName | ||
{ | ||
xSqlServerSetup SQLServer | ||
{ | ||
SourcePath = $Node.SourcePath | ||
SourceFolder = $Node.SourceFolder | ||
SetupCredential = $Node.SetupCredential | ||
InstanceName = $Node.InstanceName | ||
Features = $Node.Features | ||
SQLSysAdminAccounts = $Node.SQLSysAdminAccounts | ||
InstallSharedDir = $Node.InstallSharedDir | ||
InstallSharedWOWDir = $Node.InstallSharedWOWDir | ||
InstanceDir = $Node.InstanceDir | ||
InstallSQLDataDir = $Node.InstallSQLDataDir | ||
SQLUserDBDir = $Node.SQLUserDBDir | ||
SQLUserDBLogDir = $Node.SQLUserDBLogDir | ||
SQLTempDBDir = $Node.SQLTempDBDir | ||
SQLTempDBLogDir = $Node.SQLTempDBLogDir | ||
SQLBackupDir = $Node.SQLBackupDir | ||
} | ||
xSQLServerFirewall SQLFirewall | ||
{ | ||
DependsOn = "[xSqlServerSetup]SQLServer" | ||
InstanceName = $Node.InstanceName | ||
Features = $Node.Features | ||
SourcePath = $Node.SourcePath | ||
SourceFolder = $Node.SourceFolder | ||
} | ||
} | ||
} | ||
|
||
$SetupCredential = New-Object System.Management.Automation.PSCredential ("Administrator", (ConvertTo-SecureString -String $Password -AsPlainText -Force)) | ||
|
||
$ConfiguraionData = @{ | ||
AllNodes = @( | ||
@{ | ||
NodeName = '*' | ||
PSDscAllowPlainTextPassword = $true | ||
SourcePath = "D:\" | ||
SourceFolder = "" | ||
}, | ||
@{ | ||
NodeName = "localhost" | ||
InstanceName = "MSSQLSERVER" | ||
Features = "SQLENGINE,FULLTEXT,REPLICATION" | ||
SetupCredential = $SetupCredential | ||
SQLSysAdminAccounts = ".\administrator" | ||
InstallSharedDir = "C:\Program Files\Microsoft SQL Server" | ||
InstallSharedWOWDir = "C:\Program Files (x86)\Microsoft SQL Server" | ||
InstanceDir = "C:\Program Files\Microsoft SQL Server" | ||
InstallSQLDataDir = "" | ||
SQLUserDBDir = "" | ||
SQLUserDBLogDir = "" | ||
SQLTempDBDir = "" | ||
SQLTempDBLogDir = "" | ||
SQLBackupDir = "" | ||
TCPPort = "1433" | ||
} | ||
) | ||
} | ||
|
||
LCM -OutputPath C:\temp | ||
Set-DscLocalConfigurationManager -Path c:\temp | ||
Get-DscLocalConfigurationManager | ||
|
||
SQLServer -OutputPath (Join-Path "C:\temp" "Mof") -ConfigurationData $ConfiguraionData -Verbose | ||
Start-DscConfiguration -Path (Join-Path "C:\temp" "Mof") -Verbose -Wait -Force | ||
Get-DscConfiguration |