Github user nakomis commented on the pull request:

    https://github.com/apache/brooklyn-server/pull/150
  
    @bostko I've been trying to reproduce the issue manually, by provisioning a 
windows VM, installing ADDS remotely using pywinrm with 
`-NoRebootOnCompletion`, then reconnecting to reboot, then reconnecting using 
domain credentials. It all worked successfully
    
    I think it's going to be worth spending some time looking into this - the 
`-NoRebootOnCompletion` and `INSTALL_REBOOT_REQUIRED` pattern seems much 
cleaner, even if we need to jump through some hoops to get the authentication 
working correctly
    
    Here's my rough notes from my testing:
    
    Created a VM:
    
    ```
    services:
    - type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess
      brooklyn.config:
        launch.command: echo true
        checkRunning.command: echo true
    location: AWS Oregon Win
    ```
    
    RDPd to the VM, and ran:
    
    ```
    winrm set winrm/config/service/auth @{Basic="True"}
    ```
    
    Then created `C:\ads.ps1`
    
    ```
    Add-windowsfeature AD-Domain-Services
    Import-Module ADDSDeployment
    $pwd = "thepassword$!123Password"
    $securepwd = ConvertTo-SecureString $pwd -AsPlainText -Force
    $domainName = "mydomain.com"
    $domainNetbiosName = "mydomain"
    Install-ADDSForest -DomainName $domainName -DomainNetbiosName 
$domainNetbiosName -NoRebootOnCompletion -SafeModeAdministratorPassword: 
$securepwd -Force: $true
    ```
    
    pywinrm to the VM and ran:
    
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator', 'password'))
    r = s.run_ps("C:\\ads.ps1")
    r.std_out
    ```
    
    Tried connecting again (success):
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator', 'password'))
    r = s.run_ps("ls")
    r.std_out
    ```
    
    Rebooted (success):
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator', 'password'))
    r = s.run_ps("Restart-Computer -Force")
    r.std_out
    ```
    
    Tried various connections... (all successful)
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator', 'password'))
    r = s.run_ps("ls")
    r.std_out
    ```
    
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator@WIN-H2SOO1DO89C', 
'password'))
    r = s.run_ps("ls")
    r.std_out
    ```
    
    ```
    s = winrm.Session('52.39.83.40', auth=('Administrator@mydomain', 
'password'))
    r = s.run_ps("ls")
    r.std_out
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to