windows:powershell:insertinstanceconfig
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| windows:powershell:insertinstanceconfig [2013/11/05 17:33] – created haidong | windows:powershell:insertinstanceconfig [2018/05/15 03:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| <code powershell insertInstanceConfig.ps1> | <code powershell insertInstanceConfig.ps1> | ||
| - | function getInstanceConfig($ServerInstance) | + | function getInstanceConfig($ServerInstance) { |
| - | { | + | |
| $InstanceConfigQuery = @" | $InstanceConfigQuery = @" | ||
| | | ||
| Line 21: | Line 20: | ||
| $myHashtable = @{Configuration_Id = $_.configuration_id; | $myHashtable = @{Configuration_Id = $_.configuration_id; | ||
| $_.name; Value = $_.value; ValueInUse = $_.value_in_use} | $_.name; Value = $_.value; ValueInUse = $_.value_in_use} | ||
| - | [void] $dataIndexArray.add($myHashtable) | + | [void] $dataIndexArray.add($myHashtable)} |
| - | | + | $dataIndexArray} |
| - | $dataIndexArray | + | |
| - | } | + | function insertInstanceConfigSQL($instanceConfig, |
| + | $ConfigurationId, | ||
| + | $instanceConfig.Configuration_Id, | ||
| + | $sql = "EXEC Windows.InstanceConfig_Insert $InstanceID, | ||
| + | return $sql} | ||
| $InstanceList = Invoke-Sqlcmd -Query "exec Windows.Instance_Select_InstanceID_InstanceName" | $InstanceList = Invoke-Sqlcmd -Query "exec Windows.Instance_Select_InstanceID_InstanceName" | ||
| Line 32: | Line 35: | ||
| $InstanceID = $_.InstanceID | $InstanceID = $_.InstanceID | ||
| - | | + | |
| | | ||
| | | ||
| - | $ConfigurationId, | + | $sql = insertInstanceConfigSQL |
| - | $_.Configuration_Id, | + | |
| - | + | Catch [Exception] | |
| - | $sql = "EXEC Windows.InstanceConfig_Insert | + | |
| - | $ConfigurationId, | + | |
| - | | + | |
| - | } | + | |
| - | | + | |
| - | Catch { Return | + | |
| - | } | + | |
| </ | </ | ||
windows/powershell/insertinstanceconfig.1383672788.txt.gz · Last modified: (external edit)
