I see the unknown command in the error message is \UpdateView.exe. Note that there's a "\" in the name, but there's nothing before it. Check the value of the $HelperPath because I don't see that variable being initialized in the code you posted.
Error running power shell "... is not recognized as the name of a cmdlet"
john john
986
Reputation points
I have the following inside my Power Shell PS1 file, to set Tls12 + call .exe :-
Show-Message -Message "Step 1a: Create groups and adding users to it" & "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $HelperPath\UpdateView.exe" "true" $Username $Password If ((Get-Content $ErrorLogFile) -ne $Null) { Show-Message -Message "Creating group and adding users to it failed" -Type ([MessageType]::Failure) RevertAll $ScriptDirectory 1 return }
but i am getting this error:-
& : The term '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
\UpdateView.exe' 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 C:\c\tree\master\cloud\src\deployments\Scripts\Deploy.ps1:352 char:7
- & "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityPro ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : ObjectNotFound: ([Net.ServicePoi....UpdateView.exe:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
any advice please?
2 answers
Sort by: Most helpful
-
-
MotoX80 35,136 Reputation points
2022-06-19T12:49:58.51+00:00 Change the second line to these 2 lines.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 & "$HelperPath\UpdateView.exe" "true" $Username $Password