我尝试使用PowerShell自动安装SQL Server Express 2012,如以下脚本所示:
$Password = "MyP@ssw0rd"
$instanceName = "SQLEXPRESS"
$InstanceId = "SQLEXPRESS"
$User = "sqlsvr12ex"
$SQLAdmins = "VLILEN014120VM\Administrator"
$securestring = ConvertTo-SecureString $Password -AsPlainText -Force
$cmd = @"
"C:\SQLK\SQLEXPR_x64_ENU.exe" /QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /FEATURES=SQLENGINE
/INSTANCENAME=$($instanceName) /INSTANCEID=$($InstanceId) /SQLSVCACCOUNT="$($User)" /SQLSVCPASSW0RD=""$($securestring)"
/SQLSYSADMINACCOUNTS="$($SQLAdmins)" /INDICATEPROGRESS
"@
Write-Host "Installing"
Write-Host $cmd
& cmd.exe /c $cmd
但是,我无法安装它并收到以下错误消息:
Overall summary:
Final result: Failed: see details below
Exit code (Decimal): -2068709375
Exit facility code: 1202
Exit error code: 1
Exit message: The object state property 'this.InstanceId' is null/empty.
Start time: 2017-07-04 16:48:41
End time: 2017-07-04 16:49:23
Requested action: Install
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.2100.60&EvtType=0x7D924E88%400xF762992B%401202%401&EvtType=0x7D924E88%400xF762992B%401202%401
Setup completed with required actions for features.
Troubleshooting information for those features:
Next step for SQLEngine: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Machine Properties:
Machine name: VLILEN014120VM
Machine processor count: 16
OS version: Future Windows Version
OS service pack:
OS region: United States
OS language: English (United States)
OS architecture: x64
Process architecture: 64 Bit
OS clustered: No
Product features discovered:
Product Instance Instance ID Feature Language Edition Version Clustered
Package properties:
Description: Microsoft SQL Server 2012
ProductName: SQL Server 2012
Type: RTM
Version: 11
SPLevel: 0
Installation location: c:\6edee20eca4fd86987c7534278c4ca\x64\setup\
Installation edition: Express
Product Update Status:
None discovered.
User Input Settings:
ACTION: Install
ADDCURRENTUSERASSQLADMIN: true
AGTSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
AGTSVCPASSWORD: *****
AGTSVCSTARTUPTYPE: Disabled
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSERVERMODE: MULTIDIMENSIONAL
ASSVCACCOUNT: <empty>
ASSVCPASSWORD: <empty>
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS: <empty>
ASTEMPDIR: Temp
BROWSERSVCSTARTUPTYPE: Automatic
CLTCTLRNAME: <empty>
CLTRESULTDIR: <empty>
CLTSTARTUPTYPE: 0
CLTSVCACCOUNT: <empty>
CLTSVCPASSWORD: <empty>
CLTWORKINGDIR: <empty>
COMMFABRICENCRYPTION: 0
COMMFABRICNETWORKLEVEL: 0
COMMFABRICPORT: 0
CONFIGURATIONFILE:
CTLRSTARTUPTYPE: 0
CTLRSVCACCOUNT: <empty>
CTLRSVCPASSWORD: <empty>
CTLRUSERS: <empty>
ENABLERANU: true
ENU: true
ERRORREPORTING: false
FEATURES: SQLENGINE
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME: <empty>
FTSVCACCOUNT: <empty>
FTSVCPASSWORD: <empty>
HELP: false
INDICATEPROGRESS: false
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL Server\
INSTALLSHAREDWOWDIR: C:\Program Files (x86)\Microsoft SQL Server\
INSTALLSQLDATADIR: <empty>
INSTANCEDIR: C:\Program Files\Microsoft SQL Server\
INSTANCEID: <empty>
INSTANCENAME: <empty>
ISSVCACCOUNT: NT AUTHORITY\Network Service
ISSVCPASSWORD: <empty>
ISSVCSTARTUPTYPE: Automatic
MATRIXCMBRICKCOMMPORT: 0
MATRIXCMSERVERNAME: <empty>
MATRIXNAME: <empty>
NPENABLED: 0
PID: *****
QUIET: false
QUIETSIMPLE: true
ROLE: AllFeatures_WithDefaults
RSINSTALLMODE: DefaultNativeMode
RSSHPINSTALLMODE: DefaultSharePointMode
RSSVCACCOUNT: <empty>
RSSVCPASSWORD: <empty>
RSSVCSTARTUPTYPE: Automatic
SAPWD: <empty>
SECURITYMODE: <empty>
SQLBACKUPDIR: <empty>
SQLCOLLATION: Chinese_PRC_CI_AS
SQLSVCACCOUNT: <empty>
SQLSVCPASSWORD: <empty>
SQLSVCSTARTUPTYPE: Automatic
SQLSYSADMINACCOUNTS: <empty>
SQLTEMPDBDIR: <empty>
SQLTEMPDBLOGDIR: <empty>
SQLUSERDBDIR: <empty>
SQLUSERDBLOGDIR: <empty>
SQMREPORTING: false
TCPENABLED: 0
UIMODE: AutoAdvance
UpdateEnabled: true
UpdateSource: MU
X86: false
Configuration file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20170704_164747\ConfigurationFile.ini
Detailed results:
Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Rules with failures:
Global rules:
Scenario specific rules:
Rules report file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20170704_164747\SystemConfigurationCheck_Report.htm
Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented
Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInvalidOperationException
Message:
The object state property 'this.InstanceId' is null/empty.
HResult : 0x84b20001
FacilityCode : 1202 (4b2)
ErrorCode : 1 (0001)
Data:
ChainerInvalidOperationExceptionData = this.InstanceId
DisableWatson = true
Stack:
at Microsoft.SqlServer.Configuration.SetupExtension.InstanceIdPrivateConfigObject.ValidateSettings()
at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.ValidateSettings(IEnumerable`1 settingIds)
at Microsoft.SqlServer.Configuration.SetupExtension.ValidateFeatureSettingsAction.ExecuteAction(String actionId)
at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun, ServiceContainer context)
那为什么呢?有人可以帮忙解决这个问题吗?