Dejulia489 / WindowsServiceManager

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

StringContainingPath parameter doesn't accept spaces after version 4.4.9 #40

Closed jabteles closed 4 years ago

jabteles commented 4 years ago

Hi,

After updating task from version 4.3.5 to 4.4.9 the "Start command" input box in "Install Service" section of the task doesn't accept paths with white spaces.

I was passing the string "%programfiles%\enterprise\$(Service.Name)\ServiceName.exe" working in 4.3.5.

Which now gives the error (Some data anonymized) in 4.4.9:

2020-07-01T08:40:25.9820188Z ##[debug]Evaluating condition for step: 'Deploy Windows Service'
2020-07-01T08:40:25.9820834Z ##[debug]Evaluating: succeeded()
2020-07-01T08:40:25.9821011Z ##[debug]Evaluating succeeded:
2020-07-01T08:40:25.9821263Z ##[debug]=> True
2020-07-01T08:40:25.9821484Z ##[debug]Result: True
2020-07-01T08:40:25.9821701Z ##[section]Starting: Deploy Windows Service
2020-07-01T08:40:25.9895214Z ==============================================================================
2020-07-01T08:40:25.9895359Z Task         : Windows Service Manager
2020-07-01T08:40:25.9895474Z Description  : Deploys a Windows Service to an Agent or a Deployment Group Target using WinRM.
2020-07-01T08:40:25.9895592Z Version      : 4.4.9
2020-07-01T08:40:25.9895682Z Author       : MDSolutions
2020-07-01T08:40:25.9895785Z Help         : [More Information](https://github.com/Dejulia489/WindowsServiceManager)
2020-07-01T08:40:25.9896060Z ==============================================================================
2020-07-01T08:40:26.6667778Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2020-07-01T08:40:26.8067289Z ##[debug]INPUT_DEPLOYMENTTYPE: 'Agent'
2020-07-01T08:40:26.8125302Z ##[debug]INPUT_SERVICENAME: 'ServiceName'
2020-07-01T08:40:26.8182189Z ##[debug]INPUT_ARTIFACTPATH: 'C:\tmp\ServiceName\'
2020-07-01T08:40:26.8244212Z ##[debug]INPUT_TIMEOUT: '30'
2020-07-01T08:40:26.8300736Z ##[debug]INPUT_CLEANINSTALL: 'true'
2020-07-01T08:40:26.8323637Z ##[debug] Converted to bool: True
2020-07-01T08:40:26.8379952Z ##[debug]INPUT_RECREATESERVICE: 'false'
2020-07-01T08:40:26.8393684Z ##[debug] Converted to bool: False
2020-07-01T08:40:26.8453304Z ##[debug]INPUT_STOPPROCESS: 'true'
2020-07-01T08:40:26.8466385Z ##[debug] Converted to bool: True
2020-07-01T08:40:26.8522283Z ##[debug]INPUT_INSTALLSERVICE: 'true'
2020-07-01T08:40:26.8535857Z ##[debug] Converted to bool: True
2020-07-01T08:40:26.8591613Z ##[debug]INPUT_STARTSERVICE: 'true'
2020-07-01T08:40:26.8608302Z ##[debug] Converted to bool: True
2020-07-01T08:40:26.8709755Z ##[debug]Entering C:\ReleaseAgents\agent1\_work\_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.4.9\DeployWindowsService.ps1.
2020-07-01T08:40:26.8792091Z ##[debug]INPUT_MACHINES: 'ServerName'
2020-07-01T08:40:26.8941889Z Begining deployment to [ServerName]
2020-07-01T08:40:26.8962455Z ##[debug]INPUT_ADMINLOGIN: 'domain\user'
2020-07-01T08:40:26.8981299Z ##[debug]INPUT_PASSWORD: '***'
2020-07-01T08:40:26.9079587Z ##[debug]INPUT_NEWPSSESSIONOPTIONARGUMENTS (empty)
2020-07-01T08:40:26.9162614Z ##[debug]Entering Get-NewPSSessionOption.
2020-07-01T08:40:26.9243035Z ##[debug] arguments: ''
2020-07-01T08:40:26.9258583Z ##[debug]New-PSSessionOption command: New-PSSessionOption 
2020-07-01T08:40:26.9382459Z ##[debug]Leaving Get-NewPSSessionOption.
2020-07-01T08:40:26.9407936Z ##[debug]INPUT_USESSL: 'false'
2020-07-01T08:40:26.9421966Z ##[debug] Converted to bool: False
2020-07-01T08:40:26.9440287Z ##[debug]INPUT_INSTALLTOPSHELFSERVICE: 'false'
2020-07-01T08:40:26.9958655Z ##[debug] Converted to bool: False
2020-07-01T08:40:26.9976959Z ##[debug]INPUT_INSTALLATIONPATH: '"c:\program files\enterprise\ServiceName\ServiceName.Main.exe"'
2020-07-01T08:40:26.9993266Z ##[debug]INPUT_SERVICEDISPLAYNAME (empty)
2020-07-01T08:40:27.0008979Z ##[debug]INPUT_SERVICEDESCRIPTION (empty)
2020-07-01T08:40:27.0025302Z ##[debug]INPUT_SERVICESTARTUPTYPE: 'Automatic'
2020-07-01T08:40:27.0511391Z ##[debug]INPUT_RUNASUSERNAME: 'domain\user'
2020-07-01T08:40:27.0545242Z ##[debug]INPUT_RUNASPASSWORD: '***'
2020-07-01T08:40:28.2951623Z [ServerName]: Attempting to locate [ServiceName]
2020-07-01T08:40:28.9055950Z [ServerName]: Identified [ServiceName] installation directory []
2020-07-01T08:40:28.9527799Z [ServerName]: [ServiceName] started successfully!
2020-07-01T08:40:28.9652723Z ##[debug]Caught exception from task script.
2020-07-01T08:40:28.9679063Z ##[debug]Error record:
2020-07-01T08:40:29.0283683Z ##[debug]String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string [C:\Program Files\enterprise\ServiceName\ServiceName.Main.exe]
2020-07-01T08:40:29.0291971Z ##[debug]    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
2020-07-01T08:40:29.0300392Z ##[debug]    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-FullExecuteablePath
2020-07-01T08:40:29.0310476Z ##[debug] 
2020-07-01T08:40:29.0323675Z ##[debug]Script stack trace:
2020-07-01T08:40:29.0352989Z ##[debug]at Get-FullExecuteablePath, <No file>: line 124
2020-07-01T08:40:29.0363628Z ##[debug]at <ScriptBlock>, <No file>: line 253
2020-07-01T08:40:29.0375271Z ##[debug]Exception:
2020-07-01T08:40:29.0406208Z ##[debug]System.Management.Automation.RemoteException: String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string [C:\Program Files\enterprise\ServiceName\ServiceName.Main.exe]
2020-07-01T08:40:29.0623474Z ##[error]String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string [C:\Program Files\enterprise\ServiceName\ServiceName.Main.exe]
2020-07-01T08:40:29.0630895Z ##[debug]Processed: ##vso[task.logissue type=error]String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string [C:\Program Files\enterprise\ServiceName\ServiceName.Main.exe%5D
2020-07-01T08:40:29.0645639Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-07-01T08:40:29.0864420Z ##[section]Finishing: Deploy Windows Service
DarkChaos commented 4 years ago

Please wrap the path in quotes.

jabteles commented 4 years ago

Still got the same error

2020-07-01T16:28:28.6273637Z ##[debug]Evaluating condition for step: 'Deploy Windows Service'
2020-07-01T16:28:28.6274307Z ##[debug]Evaluating: succeeded()
2020-07-01T16:28:28.6274480Z ##[debug]Evaluating succeeded:
2020-07-01T16:28:28.6274768Z ##[debug]=> True
2020-07-01T16:28:28.6274980Z ##[debug]Result: True
2020-07-01T16:28:28.6275205Z ##[section]Starting: Deploy Windows Service
2020-07-01T16:28:28.6352130Z ==============================================================================
2020-07-01T16:28:28.6352260Z Task         : Windows Service Manager
2020-07-01T16:28:28.6352386Z Description  : Deploys a Windows Service to an Agent or a Deployment Group Target using WinRM.
2020-07-01T16:28:28.6352646Z Version      : 4.4.9
2020-07-01T16:28:28.6352724Z Author       : MDSolutions
2020-07-01T16:28:28.6352843Z Help         : [More Information](https://github.com/Dejulia489/WindowsServiceManager)
2020-07-01T16:28:28.6352965Z ==============================================================================
2020-07-01T16:28:29.2922461Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2020-07-01T16:28:29.4305513Z ##[debug]INPUT_DEPLOYMENTTYPE: 'Agent'
2020-07-01T16:28:29.4362307Z ##[debug]INPUT_SERVICENAME: 'ServiceName'
2020-07-01T16:28:29.4420133Z ##[debug]INPUT_ARTIFACTPATH: 'C:\tmp\ServiceName\'
2020-07-01T16:28:29.4483615Z ##[debug]INPUT_TIMEOUT: '30'
2020-07-01T16:28:29.4556530Z ##[debug]INPUT_CLEANINSTALL: 'true'
2020-07-01T16:28:29.4569485Z ##[debug] Converted to bool: True
2020-07-01T16:28:29.4628012Z ##[debug]INPUT_RECREATESERVICE: 'false'
2020-07-01T16:28:29.4642207Z ##[debug] Converted to bool: False
2020-07-01T16:28:29.4704933Z ##[debug]INPUT_STOPPROCESS: 'true'
2020-07-01T16:28:29.4718301Z ##[debug] Converted to bool: True
2020-07-01T16:28:29.4786458Z ##[debug]INPUT_INSTALLSERVICE: 'true'
2020-07-01T16:28:29.4804092Z ##[debug] Converted to bool: True
2020-07-01T16:28:29.4866262Z ##[debug]INPUT_STARTSERVICE: 'true'
2020-07-01T16:28:29.4880726Z ##[debug] Converted to bool: True
2020-07-01T16:28:29.4987094Z ##[debug]Entering C:\ReleaseAgents\agent1\_work\_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.4.9\DeployWindowsService.ps1.
2020-07-01T16:28:29.5072058Z ##[debug]INPUT_MACHINES: 'ServerName'
2020-07-01T16:28:29.5226996Z Begining deployment to [ServerName]
2020-07-01T16:28:29.5244783Z ##[debug]INPUT_ADMINLOGIN: 'domain\user'
2020-07-01T16:28:29.5264375Z ##[debug]INPUT_PASSWORD: '***'
2020-07-01T16:28:29.5357977Z ##[debug]INPUT_NEWPSSESSIONOPTIONARGUMENTS (empty)
2020-07-01T16:28:29.5453670Z ##[debug]Entering Get-NewPSSessionOption.
2020-07-01T16:28:29.5528787Z ##[debug] arguments: ''
2020-07-01T16:28:29.5545047Z ##[debug]New-PSSessionOption command: New-PSSessionOption 
2020-07-01T16:28:29.5611305Z ##[debug]Leaving Get-NewPSSessionOption.
2020-07-01T16:28:29.5637818Z ##[debug]INPUT_USESSL: 'false'
2020-07-01T16:28:29.5651710Z ##[debug] Converted to bool: False
2020-07-01T16:28:29.5670538Z ##[debug]INPUT_INSTALLTOPSHELFSERVICE: 'false'
2020-07-01T16:28:29.6200485Z ##[debug] Converted to bool: False
2020-07-01T16:28:29.6219435Z ##[debug]INPUT_INSTALLATIONPATH: '"%programfiles%\enterprise\ServiceName\ServiceName.Main.exe"'
2020-07-01T16:28:29.6237494Z ##[debug]INPUT_SERVICEDISPLAYNAME (empty)
2020-07-01T16:28:29.6254459Z ##[debug]INPUT_SERVICEDESCRIPTION (empty)
2020-07-01T16:28:29.6271585Z ##[debug]INPUT_SERVICESTARTUPTYPE: 'Automatic'
2020-07-01T16:28:29.6404697Z ##[debug]Caught exception from task script.
2020-07-01T16:28:29.6883890Z ##[debug]Error record:
2020-07-01T16:28:29.7170671Z ##[debug]Get-FullExecuteablePath : String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string ["%programfiles%\enterprise\ServiceName\ServiceName.Main.exe"]
2020-07-01T16:28:29.7178254Z ##[debug]At C:\ReleaseAgents\agent1\_work\_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.4.9\DeployWindowsService.ps1:182 char:25
2020-07-01T16:28:29.7186056Z ##[debug]+ ... ationPath = Get-FullExecuteablePath -StringContainingPath $startComma ...
2020-07-01T16:28:29.7193710Z ##[debug]+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-01T16:28:29.7201434Z ##[debug]    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
2020-07-01T16:28:29.7209162Z ##[debug]    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-FullExecuteablePath
2020-07-01T16:28:29.7216791Z ##[debug] 
2020-07-01T16:28:29.7229411Z ##[debug]Script stack trace:
2020-07-01T16:28:29.7253792Z ##[debug]at Get-FullExecuteablePath, C:\ReleaseAgents\agent1\_work\_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.4.9\DeployWindowsService.ps1: line 141
2020-07-01T16:28:29.7261630Z ##[debug]at <ScriptBlock>, C:\ReleaseAgents\agent1\_work\_tasks\WindowsServiceManager_7dad075d-a817-45ac-baab-4c1376d2885e\4.4.9\DeployWindowsService.ps1: line 182
2020-07-01T16:28:29.7269649Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-07-01T16:28:29.7277106Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-07-01T16:28:29.7284845Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-07-01T16:28:29.7292550Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-07-01T16:28:29.7304740Z ##[debug]Exception:
2020-07-01T16:28:29.7333939Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string ["%programfiles%\enterprise\ServiceName\ServiceName.Main.exe"]
2020-07-01T16:28:29.7543598Z ##[error]String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string ["%programfiles%\enterprise\ServiceName\ServiceName.Main.exe"]
2020-07-01T16:28:29.7550976Z ##[debug]Processed: ##vso[task.logissue type=error]String can't be parsed. The StringContainingPath parameter should contain a valid Path ending with an '.exe' or '.dll'. Current string ["%programfiles%\enterprise\ServiceName\ServiceName.Main.exe"%5D
2020-07-01T16:28:29.7566633Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-07-01T16:28:29.7761970Z ##[section]Finishing: Deploy Windows Service
DarkChaos commented 4 years ago

Oh I see, now you are using a Systemvariable, which contains '%' I will add this in my fix and make a PR

Dejulia489 commented 4 years ago

duplicate of #39

This should be resolved with the latest release of v2.0.65

jabteles commented 4 years ago

This still occurs with "%programfiles%\enterprise$(Service.Name)\ServiceName.exe".