Dejulia489 / WindowsServiceManager

https://marketplace.visualstudio.com/items?itemName=MDSolutions.WindowsServiceManagerWindowsServiceManager
MIT License
11 stars 9 forks source link

Error in Version 4.4 #58

Open sayeesrivenky opened 2 years ago

sayeesrivenky commented 2 years ago

We are using version 4.4 and while deploying a non-top shelf service we get this error. Error does not occur in TopShelf Service though. "The term '\Add-LocalUserToLogonAsAService.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Dejulia489 commented 2 years ago

Please be sure your target server has powershell 5.1 or above.


From: sayeesrivenky @.> Sent: Friday, September 24, 2021 7:53:04 AM To: Dejulia489/WindowsServiceManager @.> Cc: Subscribed @.***> Subject: [Dejulia489/WindowsServiceManager] Error in Version 4.4 (#58)

We are using version 4.4 and while deploying a non-top shelf service we get this error. Error does not occur in TopShelf Service though. "The term '\Add-LocalUserToLogonAsAService.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Dejulia489/WindowsServiceManager/issues/58, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFY6CKTIOSFZOTOEUPVDS7TUDRRCBANCNFSM5EVZGHXA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

sayeesrivenky commented 2 years ago

powershell version in the target server is: 5.1.14393.4583

plundber commented 2 years ago

I have same/similar issue. PIpeline have been working fine and without changes to the pipeline it suddenly stopped working.

To troubleshoot I created a delops release with just this task keeps failing with errors: 2021-11-24T10:27:54.3361792Z ##[section]Starting: Deploy Windows Service 2021-11-24T10:27:54.3614189Z ============================================================================== 2021-11-24T10:27:54.3614744Z Task : Windows Service Manager 2021-11-24T10:27:54.3615150Z Description : Deploys a Windows Service to an Agent or a Deployment Group Target using WinRM. 2021-11-24T10:27:54.3615397Z Version : 4.5.0 2021-11-24T10:27:54.3615692Z Author : MDSolutions 2021-11-24T10:27:54.3616148Z Help : More Information 2021-11-24T10:27:54.3616464Z ============================================================================== 2021-11-24T10:27:54.6980223Z . : The term 'C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\ps_modules\Vs 2021-11-24T10:27:54.6981130Z tsTaskSdk\FindFunctions.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. 2021-11-24T10:27:54.6981500Z Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 2021-11-24T10:27:54.6982112Z At C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\psmodules\VstsTaskSdk\V 2021-11-24T10:27:54.6982403Z stsTaskSdk.psm1:23 char:3 2021-11-24T10:27:54.6982576Z + . "$PSScriptRoot\FindFunctions.ps1" 2021-11-24T10:27:54.6982777Z + ~~~~~~~~~ 2021-11-24T10:27:54.6983188Z + CategoryInfo : ObjectNotFound: (C:\azagent\A2\...ndFunctions.ps1:String) [], CommandNotFoundException 2021-11-24T10:27:54.6983549Z + FullyQualifiedErrorId : CommandNotFoundException 2021-11-24T10:27:54.6983713Z
2021-11-24T10:27:54.7051280Z . : The term 'C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\ps_modules\Vs 2021-11-24T10:27:54.7051748Z tsTaskSdk\InputFunctions.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. 2021-11-24T10:27:54.7052154Z Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 2021-11-24T10:27:54.7052713Z At C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\psmodules\VstsTaskSdk\V 2021-11-24T10:27:54.7053132Z stsTaskSdk.psm1:24 char:3 2021-11-24T10:27:54.7053312Z + . "$PSScriptRoot\InputFunctions.ps1" 2021-11-24T10:27:54.7053493Z + ~~~~~~~~~~ 2021-11-24T10:27:54.7053805Z + CategoryInfo : ObjectNotFound: (C:\azagent\A2\...utFunctions.ps1:String) [], CommandNotFoundException 2021-11-24T10:27:54.7054171Z + FullyQualifiedErrorId : CommandNotFoundException

...

2021-11-24T10:27:54.8139381Z Out-Default : The term 'global:Out-Default' is not recognized as the name of a cmdlet, function, script file, or 2021-11-24T10:27:54.8139869Z operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 2021-11-24T10:27:54.8140112Z again. 2021-11-24T10:27:54.8140358Z At C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\psmodules\VstsTaskSdk\V 2021-11-24T10:27:54.8140641Z stsTaskSdk.psm1:117 char:62 2021-11-24T10:27:54.8140892Z + ... [scriptblock]::Create($scriptText)) 2>&1 3>&1 4>&1 5>&1 | Out-Default 2021-11-24T10:27:54.8141183Z + ~~~ 2021-11-24T10:27:54.8141504Z + CategoryInfo : ObjectNotFound: (global:Out-Default:String) [], CommandNotFoundException 2021-11-24T10:27:54.8141844Z + FullyQualifiedErrorId : CommandNotFoundException 2021-11-24T10:27:54.8142009Z
2021-11-24T10:27:54.8388020Z The term 'global:Out-Default' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 2021-11-24T10:27:54.8388735Z At line:1 char:929 2021-11-24T10:27:54.8388985Z + ... Continue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create ... 2021-11-24T10:27:54.8389297Z + ~~~~~~~~~~~~~ 2021-11-24T10:27:54.8732268Z ##[error]Exit code 1 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if ([Console]::InputEncoding -is [Text.UTF8Encoding] -and [Console]::InputEncoding.GetPreamble().Length -ne 0) { [Console]::InputEncoding = New-Object Text.UTF8Encoding $false } if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $
.Exception.Message -Verbose } ; Import-Module -Name 'C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'SilentlyContinue' ; $DebugPreference = 'SilentlyContinue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''C:\azagent\A2_work_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.5.0\DeployWindowsService.ps1'''))"'. 2021-11-24T10:27:54.8746693Z ##[section]Finishing: Deploy Windows Service

Windows server 2016, powershell version 5.1.14393.1066

plundber commented 2 years ago

Hi again. Removing the target machine from the deployment group and re-registering it solved it for me. Sorry for reporting before trying "everything"