Repository: incubator-brooklyn Updated Branches: refs/heads/master 6ebf82a63 -> 9a80ebe3b
Powershell scripting documentation - Remove the unnecessary Invoke-Command Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4e641be7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4e641be7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4e641be7 Branch: refs/heads/master Commit: 4e641be763b477b2a1aebf0f2dd9034cb37804f8 Parents: 6ebf82a Author: Valentin Aitken <[email protected]> Authored: Fri Oct 23 20:24:59 2015 +0300 Committer: Valentin Aitken <[email protected]> Committed: Fri Oct 23 20:27:51 2015 +0300 ---------------------------------------------------------------------- docs/guide/yaml/winrm/index.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4e641be7/docs/guide/yaml/winrm/index.md ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/winrm/index.md b/docs/guide/yaml/winrm/index.md index e09564e..959f88c 100644 --- a/docs/guide/yaml/winrm/index.md +++ b/docs/guide/yaml/winrm/index.md @@ -152,7 +152,7 @@ When you have a command inside the powershell script which want to report its no please consider adding a check for its exit code after it. Example: - C:\install.exe + & "C:\install.exe" If ($lastexitcode -ne 0) { exit $lastexitcode } @@ -283,10 +283,7 @@ became this: $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ($($env:COMPUTERNAME + "\Administrator"), $secpasswd) - Invoke-Command -ComputerName localhost -credential $mycreds -scriptblock { - param($driveLetter) - Start-Process ( $driveLetter + "setup.exe") -ArgumentList "/ConfigurationFile=C:\ConfigurationFile.ini" -RedirectStandardOutput "C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait - } -Authentication CredSSP -argumentlist $driveLetter + Start-Process ( $driveLetter + "setup.exe") -ArgumentList "/ConfigurationFile=C:\ConfigurationFile.ini" -Credential $mycreds -RedirectStandardOutput "C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait The `$pass=` line simply reads the Windows password from the entity before the script is copied to the server. This is then encrypted on the next line before being used to create a new credential object. Then, rather than calling the executable
