I have the following comment in a powershell script:
#ERROR: Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
#EXPLANATION: PowerShell calls uses TLS 1.0 for web requests by default.
# However, Exchange is expecting a higher level of TLS, so you need to tell PowerShell to use 1.2 instead of the default of TLS 1.0
#SOLUTION(s):
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
when i run the script i get this error:
s : The term 's' 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.
At ps1:4 char:14
+ ​#SOLUTION(s):
+ ~
+ CategoryInfo : ObjectNotFound: (s:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
why is it complaining about a comment?
if i remove (s) it then complains about SOLUTION itself...
You have it posted in your error log: + ​#SOLUTION(s):
There is a null character before the #
in your code to the left of SOLUTION(s):, so it is reading the line into powershell. Just delete the row #SOLUTION(s):
and retype it.
To check copy-and-paste the line into powershell console, should read out like below:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With