AWS Beanstalk – dotnet核心-aws-windows-deployment-manifest.json-postInstall-缺少PowerShell模块

我有一个dotnet核心应用程序,正在通过Azure DevOps Services管道部署到AWS。对于部署,我的部署捆绑包包含aws-windows-deployment-manifest.json文件。

在此文件中,我通过postInstall调用PowerShell脚本。有关更多信息,请参见:

How to get a postInstall PowerShell script working on an AWS Beanstalk Windows instance

PowerShell脚本按其应有的方式工作,并在AWS Beanstalk部署期间被调用。

但是,PowerShell脚本中的以下命令不起作用:

Enable-WindowsOptionalFeature -online -featureName TelnetClient -all

我调试了问题,发现在部署过程中仅缺少几个Powershell模块(例如ServerManager)。例如,在部署过程中,C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ Modules \ ServerManager目录不存在。

在部署过程中,我发现部署用户为NT AUTHORITY \ SYSTEM

当我以管理员身份通过RDC交互式登录AWS Beanstalk Windows系统时,存在C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ Modules \ ServerManager模块。

当我以管理员身份通过RDC和psexec以NT AUTHORITY \ SYSTEM身份交互登录AWS Beanstalk Windows系统时,存在C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ Modules \ ServerManager模块。

在部署过程中,仅存在以下PowerShell模块:

    Directory: C:\Windows\System32\WindowsPowerShell\v1.0\Modules


Mode                LastWriteTime         Length Name                          
----                -------------         ------ ----                          
d---s-        7/16/2016   1:23 PM                AppLocker                     
d---s-         9/6/2019   6:51 AM                AppvClient                    
d-----        7/16/2016   1:23 PM                Appx                          
d---s-        7/16/2016   1:23 PM                BitsTransfer                  
d---s-        7/16/2016   1:23 PM                BranchCache                   
d-----        7/16/2016   1:23 PM                CimCmdlets                    
d-----        7/16/2016   1:23 PM                DirectaccessClientComponents  
d-----        10/9/2019   7:01 AM                Dism                          
d-----        7/16/2016   1:23 PM                DnsClient                     
d-----        7/16/2016   1:23 PM                EventTracingManagement        
d---s-       10/24/2019  10:25 AM                IISAdministration             
d---s-        7/16/2016   1:23 PM                International                 
d-----        7/16/2016   1:23 PM                iSCSI                         
d-----        9/12/2016  11:22 AM                IscsiTarget                   
d-----        7/16/2016   1:23 PM                ISE                           
d---s-        7/16/2016   1:23 PM                Kds                           
d-----       11/19/2018   4:14 AM                microsoft.PowerShell.Archive  
d-----        7/16/2016   1:23 PM                microsoft.PowerShell.Diagnosti
                                                 cs                            
d-----        7/16/2016   1:23 PM                microsoft.PowerShell.Host     
d-----        7/16/2016   1:23 PM                microsoft.PowerShell.Managemen
                                                 t                             
d-----        6/13/2018   7:22 AM                microsoft.PowerShell.ODataUtil
                                                 s                             
d-----        7/16/2016   1:23 PM                microsoft.PowerShell.Security 
d-----        7/16/2016   1:23 PM                microsoft.PowerShell.Utility  
d-----        7/16/2016   1:23 PM                microsoft.WSMan.Management    
d-----        9/12/2016  11:22 AM                MsDtc                         
d-----        7/16/2016   1:23 PM                Netadapter                    
d-----        7/16/2016   1:23 PM                NetConnection                 
d-----        7/16/2016   1:23 PM                NetEventPacketCapture         
d-----        7/16/2016   1:23 PM                NetLbfo                       
d-----        7/16/2016   1:23 PM                NetNat                        
d-----        7/16/2016   1:23 PM                NetQos                        
d-----        9/12/2016  11:22 AM                NetSecurity                   
d-----        7/16/2016   1:23 PM                NetSwitchTeam                 
d-----        7/11/2018   3:17 AM                NetTCPIP                      
d-----        7/16/2016   1:23 PM                NetworkConnectivityStatus     
d-----        7/16/2016   1:23 PM                NetworkTransition             
d---s-        7/16/2016   1:23 PM                PKI                           
d-----        7/16/2016   1:23 PM                PnpDevice                     
d---s-       10/24/2019  10:25 AM                PowerShellWebaccess           
d-----        7/16/2016   1:23 PM                PrintManagement               
d---s-        6/13/2018   7:22 AM                PSDesiredStateConfiguration   
d-----        7/16/2016   1:23 PM                PSDiagnostics                 
d-----        7/16/2016   1:23 PM                PSScheduledJob                
d-----        7/16/2016   1:23 PM                ScheduledTasks                
d---s-        9/12/2016  11:22 AM                SecureBoot                    
d---s-        7/16/2016   1:23 PM                SecurityCmdlets               
d---s-        9/12/2016  11:22 AM                SmbShare                      
d-----         9/6/2019   6:51 AM                Storage                       
d---s-        7/16/2016   1:23 PM                TLS                           
d-----        9/12/2016  11:22 AM                TroubleshootingPack           
d---s-        9/12/2016  11:22 AM                TrustedPlatformModule         
d---s-        9/12/2016  11:29 AM                UEV                           
d-----        9/12/2016  11:22 AM                VpnClient                     
d-----        7/16/2016   1:23 PM                Wdac                          
d-----       10/24/2019  10:25 AM                WebAdministration             
d---s-        9/12/2016  11:22 AM                Whea                          
d-----        7/16/2016   1:23 PM                WindowsDeveloperLicense       
d-----        7/16/2016   1:23 PM                WindowsErrorReporting         
d-----        7/16/2016   1:23 PM                WindowsUpdate                

这是我的aws-windows-deployment-manifest.json文件的样子:

{
    "manifestVersion": 1,"deployments": {
        "aspNetCoreWeb": [
        {
            "name": "hedwig-spa","parameters": {
                "appBundle": "site.zip","iisPath": "/","iisWebSite": "Default Web Site"
            },"scripts": {
                "postInstall": {
                    "file": "C:\\path-here\\postinstall.ps1"
                }
            }
        }
        ]
    }
} 

以下是PostInstallSetup.ps1文件中失败的命令:

Enable-WindowsOptionalFeature -online -featureName TelnetClient -all > c:/cfn/installer-feature-telnet.log

Install-WindowsFeature -name Telnet-Client -LogPath c:/cfn/installer-telnet.log

有人知道为什么在AWS Beanstalk部署过程中缺少某些PowerShell模块吗?在部署期间是否可以调用以下命令:

Enable-WindowsOptionalFeature -online -featureName TelnetClient -all

swansong13 回答:AWS Beanstalk – dotnet核心-aws-windows-deployment-manifest.json-postInstall-缺少PowerShell模块

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3134792.html

大家都在问