Quantcast
Channel: AutoSPInstaller
Viewing all articles
Browse latest Browse all 2279

Commented Unassigned: Syntax issue with "Installing SMTP Windows feature in a separate PowerShell window" command? [21161]

$
0
0
While reviewing the code [AutoSPInstallerMain.ps1, line 250] using NotePad++, the editor's syntax parser seems to have an issue with the "back quote / semi-colon" delimiter in the following statement:

Start-Process -FilePath "$PSHOME\powershell.exe" -Verb Runas -ArgumentList "-Command `". $env:dp0\AutoSPInstallerFunctions.ps1`; InstallSMTP (Get-Content $inputFile); Start-Sleep 5" -Wait

Adding another quote after the back quote characters makes NotePad++ happy:

...AutoSPInstallerFunctions.ps1`"; InstallSMTP...

But, I am unsure if adding that quote maintains the integrity of what the command was intended to do.
Comments: ** Comment from web user: mcnga1 **

I agree that it does appear that the Notepad++ parser is a bit more "sensitive" than PowerGUI.

If I extract the line in question and simply do a "Write-Host"...

Write-Host Start-Process -FilePath "$PSHOME\powershell.exe" -Verb Runas -ArgumentList "-Command `". $env:dp0\AutoSPInstallerFunctions.ps1`; InstallSMTP (Get-Content $inputFile); Start-Sleep 5" -Wait

I get:

Start-Process -FilePath C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Runas -ArgumentList -Command ". \AutoSPInstallerFunctions.ps1; InstallSMTP (Get-Content ); Start-Sleep 5 -Wait

Which appears to have a missing closing quote character for the "-Command" parameter.

I agree that the command does seem to execute correctly without the closing quote.


Viewing all articles
Browse latest Browse all 2279

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>