我正在尝试使用巧克力模块在 Windows Server 2016 虚拟机(SKU:)上使用 Azure Automation DSC 配置一些包2016-Datacenter
。
一些软件包(例如
vcredist2008
)vcredist2010
- Chocolatey(从 DSC 调用)成功安装它们
- Chocolatey(从 CustomScriptExtension 调用)成功安装它们
- Chocolatey(从交互式命令提示符调用)成功安装它们
其他软件包(例如
mssqlserver2014express
和mssqlservermanagementstudio2014express
)巧克力味(来自 DSC)
无法安装
直接原因似乎由错误消息“该系统找不到指定的文件“ 为了
C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe
;
Chocolatey(从 CustomScriptExtension 调用)
无法安装
再次,直接原因似乎由错误消息指示“该系统找不到指定的文件“对于与上面相同的文件;
Chocolatey(从交互式命令提示符调用)
- 安装成功
最后一个操作表明交互式会话和 DSC(或 CustomScriptExtension)的环境之间存在差异,但是错误消息本身并没有清楚地表明直接原因。
问题:
这些与 MSSQL Express 相关的包(不是所有包)失败的原因到底是什么?
有什么方法(例如参数,配置设置)可以安装这些包吗?
细节:
对于 CustomScriptExtension(失败)和交互式命令提示符(成功),我使用了以下调用(来自 PowerShell 脚本):
choco install -y mssqlservermanagementstudio2014express
对于 Azure Automation DSC,我在配置文件中有以下任务(摘录):
cChocoPackageInstaller installVCRedist201WithChoco
{
Name = 'vcredist2010'
Ensure = 'Present'
DependsOn = '[cChocoInstaller]installChoco'
}
cChocoPackageInstaller installmssqlservermanagementstudio2014express
{
Name = 'mssqlservermanagementstudio2014express'
Ensure = 'Present'
DependsOn = '[cChocoInstaller]installChoco'
}
机器很干净,vcredist2010
安装也很好,但是mssqlservermanagementstudio2014express
出现以下错误:
2016-11-22 08:19:34,256 [INFO ] - Downloading MsSqlServerManagementStudio2014Express 64 bit
from 'https://download.microsoft.com/download/2/A/5/2A5260C3-4143-47D8-9823-E91BB0121F94/SQLManagementStudio_x64_ENU.exe'
2016-11-22 08:20:43,755 [INFO ] -
2016-11-22 08:20:44,986 [INFO ] - Download of SQLManagementStudio.exe (850.63 MB) completed.
2016-11-22 08:22:54,657 [INFO ] - C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio.exe
2016-11-22 08:22:54,922 [INFO ] - Extracting...
2016-11-22 08:23:01,164 [INFO ] - Installing...
2016-11-22 08:23:01,745 [INFO ] - Installing MsSqlServerManagementStudio2014Express...
2016-11-22 08:23:03,311 [WARN ] - WARNING: Unable to generate 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe.ignore'
2016-11-22 08:23:03,999 [WARN ] - WARNING: May not be able to find 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe'. Please use full path for executables.
2016-11-22 08:23:05,250 [ERROR] - ERROR: Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
2016-11-22 08:23:07,903 [ERROR] - The install of mssqlservermanagementstudio2014express was NOT successful.
2016-11-22 08:23:07,950 [ERROR] - Error while running 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1'.
See log for details.
2016-11-22 08:23:10,208 [WARN ] -
Chocolatey installed 1/2 packages. 1 packages failed.
See the log for details (c:\choco\logs\chocolatey.log).
2016-11-22 08:23:10,275 [INFO ] -
2016-11-22 08:23:10,321 [ERROR] - Failures
2016-11-22 08:23:10,364 [ERROR] - - mssqlservermanagementstudio2014express (exited -1) - Error while running 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1'.
See log for details.
日志文件包含:
2016-11-22 08:23:01,164 [INFO ] - Installing...
2016-11-22 08:23:01,665 [DEBUG] - Running Install-ChocolateyInstallPackage -validExitCodes '0 3010' -packageName 'MsSqlServerManagementStudio2014Express' -fileType 'EXE' -silentArgs '/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE' -file 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe'
2016-11-22 08:23:01,745 [INFO ] - Installing MsSqlServerManagementStudio2014Express...
2016-11-22 08:23:03,311 [WARN ] - WARNING: Unable to generate 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe.ignore'
2016-11-22 08:23:03,734 [DEBUG] - Running Start-ChocolateyProcessAsAdmin -validExitCodes '0 3010' -workingDirectory 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio' -statements '/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE ' -exeToRun 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe'
2016-11-22 08:23:03,953 [DEBUG] - Elevating Permissions and running ["C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe" /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE ]. This may take a while, depending on the statements.
2016-11-22 08:23:03,999 [WARN ] - WARNING: May not be able to find 'C:\Windows\TEMP\chocolatey\chocolatey\MsSqlServerManagementStudio2014Express\SQLManagementStudio\setup.exe'. Please use full path for executables.
2016-11-22 08:23:04,781 [DEBUG] - Setting RunAs for elevation
2016-11-22 08:23:05,250 [ERROR] - ERROR: Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
2016-11-22 08:23:05,509 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'c:\choco\helpers\chocolateyInstaller.psm1'; & 'c:\choco\helpers\chocolateyScriptRunner.ps1' -packageScript 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '-1'.
2016-11-22 08:23:05,557 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2016-11-22 08:23:07,369 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
2016-11-22 08:23:07,385 [DEBUG] - Capturing package files in 'c:\choco\lib\MsSqlServerManagementStudio2014Express'
2016-11-22 08:23:07,432 [DEBUG] - Found 'c:\choco\lib\MsSqlServerManagementStudio2014Express\MsSqlServerManagementStudio2014Express.nupkg'
with checksum 'AD996F040E8828374737D274BC5EF15D'
2016-11-22 08:23:07,573 [DEBUG] - Found 'c:\choco\lib\MsSqlServerManagementStudio2014Express\MsSqlServerManagementStudio2014Express.nuspec'
with checksum 'D7BE143BDF795902EAEE640DFCE85D15'
2016-11-22 08:23:07,619 [DEBUG] - Found 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1'
with checksum 'E60A57F683AB9A3A4D9C28ED78E09081'
2016-11-22 08:23:07,650 [DEBUG] - Found 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyUninstall.ps1'
with checksum '4F30E08CD2C8D4E13C3AE84AA94FBE00'
2016-11-22 08:23:07,682 [DEBUG] - Attempting to create directory "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110".
2016-11-22 08:23:07,749 [DEBUG] - Attempting to copy "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110\.files.update"
to "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110\.files".
2016-11-22 08:23:07,838 [DEBUG] - Attempting to delete file "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110\.files.update".
2016-11-22 08:23:07,854 [DEBUG] - Attempting to delete file "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110\.sxs".
2016-11-22 08:23:07,871 [DEBUG] - Attempting to delete file "c:\choco\.chocolatey\MsSqlServerManagementStudio2014Express.12.2.5000.20161110\.pin".
2016-11-22 08:23:07,885 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
2016-11-22 08:23:07,903 [ERROR] - The install of mssqlservermanagementstudio2014express was NOT successful.
2016-11-22 08:23:07,950 [ERROR] - Error while running 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1'.
See log for details.
2016-11-22 08:23:07,994 [DEBUG] - Moving 'c:\choco\lib\MsSqlServerManagementStudio2014Express'
to 'c:\choco\lib-bad\MsSqlServerManagementStudio2014Express'
2016-11-22 08:23:10,053 [DEBUG] - Attempting to delete file "C:\Windows\system32\config\systemprofile\AppData\Local\NuGet\Cache\MsSqlServerManagementStudio2014Express.12.2.5000.20161110.nupkg".
2016-11-22 08:23:10,208 [WARN ] -
Chocolatey installed 1/2 packages. 1 packages failed.
See the log for details (c:\choco\logs\chocolatey.log).
2016-11-22 08:23:10,275 [INFO ] -
2016-11-22 08:23:10,321 [ERROR] - Failures
2016-11-22 08:23:10,364 [ERROR] - - mssqlservermanagementstudio2014express (exited -1) - Error while running 'c:\choco\lib\MsSqlServerManagementStudio2014Express\tools\ChocolateyInstall.ps1'.
See log for details.
2016-11-22 08:23:10,396 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2016-11-22 08:23:10,431 [DEBUG] - Exiting with -1
答案1
迟到了,但因为我遇到了这个问题(尽管是在较新版本的 SQL Server Express),我发现(进程监控) 中创建了一个额外的日志文件C:\Windows\temp\chocolatey
,在我的例子中称为SQLEXPR_decompression_log.txt
。 SQLEXPR 安装程序拒绝从系统文件夹展开安装程序:
[2020-01-30T10:27:15.014+10:00]: === Logging started: 2020/01/30 10:27:15 ===
[2020-01-30T10:27:15.014+10:00]: Executable: C:\Windows\TEMP\chocolatey\sql-server-express\2017.20190916\SQLEXPR.exe v14.0.1000.169
[2020-01-30T10:27:15.014+10:00]: Computer : BA-MD-2
[2020-01-30T10:27:15.014+10:00]: --- logging level: standard ---
[2020-01-30T10:27:15.030+10:00]: Successfully bound to the ClusApi.dll
[2020-01-30T10:27:15.030+10:00]: Cannot open the current cluster
[2020-01-30T10:27:15.030+10:00]: Cluster drive map: ''
[2020-01-30T10:27:15.030+10:00]: Error 0x80070150: The application cannot be decompressed to a system directory.
[2020-01-30T10:27:15.030+10:00]: Error 0x80070150: Unsupported directory
[2020-01-30T10:27:15.030+10:00]: Error 0x80070150: Failed to validate directory for extraction
[2020-01-30T10:27:15.030+10:00]: Error 0x80070150: Failed to select the directory to extract to
[2020-01-30T10:27:15.030+10:00]: Error 0x80070150: Failed to select and/or prepare the directory for extraction
[2020-01-30T10:27:15.030+10:00]: The application cannot be decompressed to a system directory. Please select a different location.
[2020-01-30T10:27:15.030+10:00]: Exiting with result code: 0x80070150
[2020-01-30T10:27:15.030+10:00]: === Logging stopped: 2020/01/30 10:27:15 ===
为了解决这个问题,我对 chocolatey 安装和 chocolatey DSC 资源使用了管理员帐户凭据,因此它从该帐户的临时文件而不是系统临时文件运行:
User localadminUser {
Ensure = "Present"
UserName = "localadmin"
Password = $localadmin_credential
PasswordChangeNotAllowed = $true
PasswordChangeRequired = $false
PasswordNeverExpires = $true
}
Group localadminUserAsAdmin {
GroupName = 'Administrators'
Ensure = 'Present'
MembersToInclude = "localadmin"
DependsOn = "[User]localadminUser"
}
cChocoInstaller installChoco
{
InstallDir = 'C:\choco'
PsDscRunAsCredential = $localadmin_credential
DependsOn = "[Group]localadminUserAsAdmin"
}
cChocoPackageInstaller installSqlExpress
{
Ensure = "Present"
Name = "sql-server-express"
Version = "2017.20190916"
PsDscRunAsCredential = $localadmin_credential
DependsOn = "[cChocoInstaller]installChoco"
}