Repository: brooklyn-docs
Updated Branches:
  refs/heads/master c87b43fbb -> 31cf15ae8


WinRM documentation - run as Administrator


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/5d9ea1b5
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/5d9ea1b5
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/5d9ea1b5

Branch: refs/heads/master
Commit: 5d9ea1b57fd725611d1732ab581add8c140986a9
Parents: c87b43f
Author: Valentin Aitken <bos...@gmail.com>
Authored: Tue Mar 1 11:10:26 2016 +0200
Committer: Valentin Aitken <bos...@gmail.com>
Committed: Tue Mar 1 11:18:36 2016 +0200

----------------------------------------------------------------------
 guide/yaml/winrm/index.md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/5d9ea1b5/guide/yaml/winrm/index.md
----------------------------------------------------------------------
diff --git a/guide/yaml/winrm/index.md b/guide/yaml/winrm/index.md
index a787aa0..335cddd 100644
--- a/guide/yaml/winrm/index.md
+++ b/guide/yaml/winrm/index.md
@@ -116,6 +116,26 @@ The installation script - referred to as 
`/Users/richard/install7zip.ps1` in the
 
     Start-Process "msiexec" -ArgumentList '/qn','/i',$Dl 
-RedirectStandardOutput ( [System.IO.Path]::Combine($Path, "stdout.txt") ) 
-RedirectStandardError ( [System.IO.Path]::Combine($Path, "stderr.txt") ) -Wait
 
+In some the installer command may not obtain properly Administrator priviliges 
and you may get access is denied error during the setup process.
+For this case we strongly recommend enabling CredSSP and using the 
`Invoke-Command`.
+
+Here is a snippet for enabling CredSSP and using `Invoke-Command` through it.
+
+    & winrm set winrm/config/service/auth '@{CredSSP="true"}'
+    & winrm set winrm/config/client/auth '@{CredSSP="true"}'
+    #
+    $pass = '${attribute['windows.password']}'
+    $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
+    $mycreds = New-Object System.Management.Automation.PSCredential 
($($env:COMPUTERNAME + "\${location.user}"), $secpasswd)
+    #
+    $exitCode = Invoke-Command -ComputerName $env:COMPUTERNAME -Credential 
$mycreds -ScriptBlock {
+        param($driveLetter)
+        $process = Start-Process ( $driveLetter + "setup.exe") -ArgumentList 
"/ConfigurationFile=C:\ConfigurationFile.ini" -RedirectStandardOutput 
"C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait -PassThru 
-NoNewWindow
+        $process.ExitCode
+    } -Authentication CredSSP -ArgumentList $driveLetter
+    #
+    exit $exitCode
+
 This is only a very simple example. A more complex example can be found in the 
[Microsoft SQL Server blueprint in the
 Brooklyn source code]({{ site.brooklyn.url.git 
}}/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql).
 

Reply via email to