ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.9k stars 23.9k forks source link

Ansible not executing powershell script or command in elevated shell mode #78689

Closed sysnetstriver closed 2 years ago

sysnetstriver commented 2 years ago

Summary

I have tried 3 different task methods to get Ansible to execute a powershell command or a ps1 script with the command in an elevated Administrator shell. I am a DOMAIN Admin and the computer is domain joined. All other powershell module tasks prior to this one work with my domain admin SA account. The command in the problem task is Import-Module -Name DellBIOSProvider -Verbose -Force. When I test this locally under my DOMAIN admin account it fails at the operation of ..New-PSDrive.. could not be created, please run with Administrator privileges. So to get it working I have to run powershell as Admin (system32) and the Import-Module command completes the New-PSDrive operation without fail. But Ansible is not executing the command or ps1 script in elevated mode it seems even with me using become_method become and become_user for local-admin execution. I have searched for days on how to get this to work. I found one other person that describes my problem on github but the conversation was then moved to private Github issue and I found this info on stackoverflow Powershell script in elevated mode . None of these implementations work. The output of Get-PSDrive should show the DellSmBIOS PS drive after successful import so that subsequent playbook tasks can use the new ps-drive for pwrsh configuration calls but the it is not there because Ansible is running it under my domain admin sa account.

Issue Type

Bug Report

Component Name

ansible.windows.win_powershell

Ansible Version

$ ansible --version
$ ansible --version
ansible [core 2.13.3]
  config file = /home/arichardson.sa/monorepo/ansible/ansible.cfg
  configured module search path = ['/home/arichardson.sa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible
  ansible collection location = /home/arichardson.sa/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.13 (main, May 23 2022, 22:02:02) [GCC 7.5.0]
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
[DEPRECATION WARNING]: [defaults]callback_whitelist option, normalizing names to new standard, use callbacks_enabled instead. This feature will be removed
from ansible-core in version 2.15. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ANSIBLE_NOCOWS(/home/arichardson.sa/monorepo/ansible/ansible.cfg) = True
CALLBACKS_ENABLED(/home/arichardson.sa/monorepo/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_FORKS(/home/arichardson.sa/monorepo/ansible/ansible.cfg) = 64
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/arichardson.sa/monorepo/ansible/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/arichardson.sa/monorepo/ansible/ansible.cfg) = yaml

OS / Environment

Control host: NAME="Ubuntu" VERSION="18.04.6 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.6 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic

Target OS: Windows 10 Professional Version 21H2 OS Build 19044.1889

Steps to Reproduce

arichardson.sa@linus:~/monorepo/ansible (703-set-admin-password-on-bios) $ sudo cat roles/dell_endpoints_bios/tasks/main.yaml
#- name: 'Ensure the required NuGet package provider is installed'
#  win_shell: |
#    Find-PackageProvider `
#      -Name Nuget `
#      -ForceBootstrap `
#      -IncludeDependencies `
#      -Force

- name: 'Set Execution policy'
  ansible.windows.win_powershell:
    script: |
      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

- name: 'Install Module'
  ansible.windows.win_powershell:
    script: |
      Find-Module -Name DellBIOSProvider | Install-Module -Force

- name: 'Verify that the module is available along with the available exported commands'
  ansible.windows.win_shell: 'Get-Module -ListAvailable'

- name: 'Create module directory if it does not exist'
  ansible.windows.win_powershell:
    script: |
      If (-NOT (Test-Path "${env:ProgramFiles}\WindowsPowerShell\Modules")) {
        New-Item -Path "${env:ProgramFiles}\WindowsPowerShell\Modules" -ItemType "directory" -Force }

##### METHOD 1 FOR IMPORTING MODULE IN ADMINISTRATOR ELEVATED SHELL
- name: 'Copy ps script to host'
  ansible.builtin.win_copy:
    src: '{{ role_path }}/library/psmodule.ps1'
    dest: '{{ ansible_script_dir }}'

#- name: 'Import Dell Command Powershell Provider Module'
 # ansible.windows.win_shell: '{{ ansible_script_dir }}\psmodule.ps1'
#  ansible.windows.win_powershell:
#    script: |
#      Import-Module -Name DellBIOSProvider -Verbose -Global -Force
 # args:
 #   no_profile: 'yes'
#  become_method: 'runas'
#  become: 'yes'
#  become_user: 'local-admin'

###### METHOD 2 FOR IMPORTING MODULE IN ADMINISTRATOR ELEVATED SHELL
- name: 'Copy PsExec'
  ansible.builtin.win_copy:
    src: '{{ role_path }}/files/PsExec.exe'
    dest: '{{ ansible_script_dir }}'
    force: no
#
- name: 'Run powershell as a specific admin user'
  ansible.builtin.win_psexec:
   # command: 'powershell.exe -executionpolicy bypass -noninteractive -nologo -file "{{ ansible_script_dir }}\psmodule.ps1"'
    command: 'powershell.exe -executionpolicy bypass -noninteractive -nologo -Command "Import-Module -Name DellBIOSProvider -Verbose -Force"'
    executable: '{{ ansible_script_dir }}\PsExec.exe'
    elevated: yes
    nobanner: yes
    username: 'local-admin'
    password: 'OBFUSCATED'
    interactive: no
#
###### METHOD 3 FOR IMPORTING MODULE IN ADMINISTRATOR ELEVATED SHELL
#- name: 'Import Dell Command Powershell Provider Module'
#  ansible.windows.win_powershell:
#    script: |
#      [CmdletBinding()]
#      param (
#          [String]
#          $username,
#          [String]
#          $pass,
#          [String].
#          $psCred,
#          [String]
#          $Command,
#          [String]
#          $FilePath,
#          [String]
#          $Verb
#      )
#
#     # $username = "arichardson.sa@america.striveworks.us"
#     # $pass = ConvertTo-SecureString "PLACEHOLDER" -AsPlainText -Force
#     # $cred = (Get-Credential)
#     # $psCred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username,$pass)
#
#     # $commands = @'
#     # Import-Module DellBIOSProvider -Verbose
#     # '@
#
#     # $arguments = @{
#     # FilePath     = 'powershell.exe'
#     # Verb         = 'RunAs'
#     # Credential   = $psCred
#     # ArgumentList = @(
#     #     '-Command',
#     #     $commands,
#     #     '-NoExit',
#     #     '-NoProfile'
#     #    )
#     # }
#      Start-Process -FilePath $FilePath -ArgumentList $args -Verb $Verb
#     # Start-Process @arguments
#     # Import-Module DellBIOSProvider -Verbose
#     # runas /noprofile /user:arichardson.sa@america.striveworks.us "Import-Module DellBIOSProvider -Verbose"
#   # arguments:
#    parameters:
#      Command: 'Import-Module DellBIOSProvider -Verbose'
#      Filepath: 'powerhsell.exe'
#      Verb: 'RunAs'
#      Arg: '-command "Import-Module DellBIOSProvider -Verbose'

- name: 'Verify the import for DellSMBIOS'
  ansible.windows.win_shell: 'Get-PSDrive'
  become_method: 'runas'
  become: 'yes'
  become_user: 'local-admin'

- name: 'Set location for working with module'
  ansible.windows.win_powershell:
    script: |
      Set-Location -Path "delldmbios:"
  become_method: 'runas'
  become: 'yes'
  become_user: 'local-admin'

###### ATTRIBUTE GETTER
#- name: 'Show available loaded attributes'
#  ansible.windows.win_powershell:
#    script: |
#      Get-ChildItem
#  become_method: 'runas'
#  become: 'yes'
#  become_user: 'local-admin'
#  register: 'attr_list'
#
###### ATTRIBUTE SETTER - SYSTEM PASSWORD BYPASS -
# This BIOS setting provides the facility to bypass the system password during system restart or resume from standby.
# If the Password Bypass feature is disabled and the system password is set, then the system prompts for the system password during every restart,
# or system resume from standby state.
# - name: 'Set Security system password bypass'
#  ansible.windows.win_powershell:
#    script: |
#      Set-Item -Path DellSmbios:\Security\PasswordBypass "Reboot and Resume Bypass"
#
####### ATTRIBUTE SETTER TASK - BIOS ADMIN PASSWORD FOR WRITE MODE -
#- name: 'Initialize admin password to be required for mutating BIOS settings'
#  ansible.windows.win_powershell:
#    script: |
#      [CmdletBinding()]
#      param (
#          [String]
#          $Path,
#          [String]
#          $AdminPwd,
#          [Switch]
#          $Force
#      )
#
#      Set-Item -Path $Path "$AdminPwd"
#    parameters:
#      Path: 'DellSmbios:\Security\AdminPassword'
#      AdminPwd: '{{ dellsmbios_admin_password }}'
#
###### ATTRIBUTE SETTER TASK - BIOS PWD REQUIRED FOR READ MODE -
#- name: 'Admin Setup Lockout'
#  ansible.windows.win_powershell:
#    script: |
#      [CmdletBinding()]
#      param (
#        [String]
#        $AdminPwd
#      )
#
#      Set-Item -Path DellSmbios:\Security\AdminSetupLockout "Disabled" -Password "$AdminPwd"
#    parameters:
#      AdminPwd: '{{ dellsmbios_admin_password }}'

- name: 'Verify BIOS mutating admin password is set or not set'
  ansible.windows.win_powershell:
    script: |
      Get-Item -Path Dellsmbios:\Security\IsAdminPasswordSet
  become_method: 'runas'
  become: 'yes'
  become_user: 'local-admin'
  register: 'bios_admin_pwd_bool'

##### ATTRIBUTE SETTER TASK - CLEAR ADMIN PASSWORD FROM BIOS -
- name: 'Clear admin password'
  ansible.windows.win_powershell:
    script: |
      [CmdletBinding()]
      param (
          [String]
          $AdminPwd
      )

      Set-Item -Path DellSmbios:\Security\AdminPassword "" -Password "Striveworks"
    parameters:
      AdminPwd: '{{ dellsmbios_admin_password }}'
  become_method: 'runas'
  become: 'yes'
  become_user: 'local-admin'

###### ATTRIBUTE SETTER TASK - BATTERY CFG -
- name: 'Configure battery charging state'
  ansible.windows.win_powershell:
    script: |
      Set-Item -Path DellSmbios:\PowerManagement\PrimaryBattChargeCfg "PrimACUse"
  become_method: 'runas'
  become: 'yes'
  become_user: 'local-admin'
  register: 'prim_battery_attr'

Expected Results

I expect that at the Import-Module....... step which runs the script/command to result in the New-PSDrive being created so that all subsequent tasks can interact with that PS drive for configuration calls via the powershell commands. But the problem is that the module appears to not be imported because I am getting these errors. Note that I did test this locally on the Windows endpoint and it shows that the module will only import when the command or script is executed in an Elevated administrator shell, not when it is executed from my domain admin user account SA shell, which is the same user account I am running the playbook from the control host as.

Local test output when attempting to import module with my domain admin account in pwrsh:

PS C:\Users\arichardson.sa> Import-Module -Name DellBIOSProvider -Verbose -Force
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.psd1'.
VERBOSE: Populating RepositorySourceLocation property for module DellBIOSProvider.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.psm1'.
VERBOSE: Exporting function 'Set-Dell1stBootdevice'.
VERBOSE: Exporting function 'Get-DellBiosSettings'.
VERBOSE: Exporting function 'Clear-DellAdminPassword'.
VERBOSE: Exporting function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Importing function 'Clear-DellAdminPassword'.
VERBOSE: Importing function 'Get-DellBiosSettings'.
VERBOSE: Importing function 'Set-Dell1stBootdevice'.
VERBOSE: Importing function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.dll'.
VERBOSE: Starting PS provider DellSmbiosProv
VERBOSE: .NET Version: 4.0.30319.42000
VERBOSE: Performing InitializeDefaultDrives operation on the 'DellSmbiosProv'provider.
VERBOSE: Performing operation New-PSDrive for the provider DellSmbiosProv.
WARNING: Please execute this program with "Administrator" privileges.
Import-Module : PS drive DellSmbios could not be created.
At line:1 char:1
+ Import-Module -Name DellBIOSProvider -Verbose -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (DellSmbios:PSDriveInfo) [Import-Module], InvalidOperationException
    + FullyQualifiedErrorId : DefaultDriveInitFailed,Microsoft.PowerShell.Commands.ImportModuleCommand
VERBOSE: Exporting function 'Clear-DellAdminPassword'.
VERBOSE: Exporting function 'Get-DellBiosSettings'.
VERBOSE: Exporting function 'Set-Dell1stBootdevice'.
VERBOSE: Exporting function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Importing function 'Clear-DellAdminPassword'.
VERBOSE: Importing function 'Get-DellBiosSettings'.
VERBOSE: Importing function 'Set-Dell1stBootdevice'.
VERBOSE: Importing function 'Set-DellAutoOnForSelectDays'.
PS C:\Users\arichardson.sa>

EXPECTED RESULT: Local test output when executing from Administrator Elevated shell showing success of Dellsmbios PS Drive:

PS C:\Windows\system32> Import-Module -Name DellBIOSProvider -Verbose -Force
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.psd1'.
VERBOSE: Populating RepositorySourceLocation property for module DellBIOSProvider.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.psm1'.
VERBOSE: Exporting function 'Set-Dell1stBootdevice'.
VERBOSE: Exporting function 'Get-DellBiosSettings'.
VERBOSE: Exporting function 'Clear-DellAdminPassword'.
VERBOSE: Exporting function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Importing function 'Clear-DellAdminPassword'.
VERBOSE: Importing function 'Get-DellBiosSettings'.
VERBOSE: Importing function 'Set-Dell1stBootdevice'.
VERBOSE: Importing function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.dll'.
VERBOSE: Starting PS provider DellSmbiosProv
VERBOSE: .NET Version: 4.0.30319.42000
VERBOSE: Performing InitializeDefaultDrives operation on the 'DellSmbiosProv'provider.
VERBOSE: Performing operation New-PSDrive for the provider DellSmbiosProv.
VERBOSE: Category 'Passwords' does not contain any supported attributes.
VERBOSE: Category 'BIOSSetupAdvancedMode' does not contain any supported attributes.
VERBOSE: Category 'StealthModeControl' does not contain any supported attributes.
VERBOSE: Category 'AdvancedConfigurations' does not contain any supported attributes.
VERBOSE: Category 'ThermalConfiguration' does not contain any supported attributes.
VERBOSE: To get more help about the Dell Command PowerShell provider, type Get-Help DellBIOSProvider.
VERBOSE: Exporting function 'Clear-DellAdminPassword'.
VERBOSE: Exporting function 'Get-DellBiosSettings'.
VERBOSE: Exporting function 'Set-Dell1stBootdevice'.
VERBOSE: Exporting function 'Set-DellAutoOnForSelectDays'.
VERBOSE: Importing function 'Clear-DellAdminPassword'.
VERBOSE: Importing function 'Get-DellBiosSettings'.
VERBOSE: Importing function 'Set-Dell1stBootdevice'.
VERBOSE: Importing function 'Set-DellAutoOnForSelectDays'.
PS C:\Windows\system32>

EXPECTED RESULT after importing module showing the new ps drive DellSmbios:

PS C:\> Get-PSDrive

Name           Used (GB)     Free (GB) Provider      Root                                                                                                                                          CurrentLocation
----           ---------     --------- --------      ----                                                                                                                                          ---------------
Alias                                  Alias
C                 269.00        205.31 FileSystem    C:\
Cert                                   Certificate   \
DellSmbios                             DellSmbios... DellSmbios:\
Env                                    Environment
Function                               Function
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE
Variable                               Variable
WSMan                                  WSMan

Output showing my user account is an admin:

C:\Users\arichardson.sa>net user arichardson.sa /DOMAIN
The request will be processed at a domain controller for domain america.striveworks.us.

User name                    arichardson.sa
Full Name
Comment
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            3/20/2022 10:00:43 PM
Password expires             Never
Password changeable          3/20/2022 10:00:43 PM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   9/1/2022 11:35:56 AM

Logon hours allowed          All

Local Group Memberships
Global Group memberships     *RADIUS-NAC           *Enterprise Admins
                             *Domain Users         *Domain Admins
The command completed successfully.

C:\Users\arichardson.sa>net localgroup Administrators
Alias name     Administrators
Comment        Administrators have complete and unrestricted access to the computer/domain

Members

-------------------------------------------------------------------------------
Administrator
AMERICA\Domain Admins
local-admin
The command completed successfully.

Actual Results

As you can see, once it gets to the task Verify the import for DellSMBIOS, the new PS Drive does not show up in the task which occurs after the Import Module task. You can see there are errors in each task after this one that refer to the ps drive not being there so it cannot perform any operations. The playbook I copied above is the most recent implementation attempt to get this to work. The results are the same no matter which task method I choose to implement. As you can see in the playbook I have written 3 different iterations with varying approaches for trying to accomplish this objective. I have also tried changing the install location of the Powershell module to not be in C:\Program Files\WindowsPowerShell\Modules to instead be located in C:\Users\arichardson.sa\Documents\WindowsPowershell\Modules thinking that the Path change would solve the elevation privilege problem but it did not. Same result.

PLAYBOOK OUTPUT AND RECAP:

PLAY [Configure Endpoint System Admin BIOS] ****************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/configure_endpoints_bios.yaml:6
Thursday 01 September 2022  14:03:58 -0500 (0:00:01.949)       0:00:07.273 ****
redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/setup.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
ok: [it.loaner_DELL-D9B1L63.america.striveworks.us]
META: ran handlers

TASK [dell_endpoints_bios : Set Execution policy] **********************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:9
Thursday 01 September 2022  14:04:01 -0500 (0:00:02.835)       0:00:10.108 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error:
  - category_info:
      activity: Set-ExecutionPolicy
      category: PermissionDenied
      category_id: 18
      reason: SecurityException
      target_name: ''
      target_type: ''
    error_details:
      message: Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy".
      recommended_action: Contact your system administrator.
    exception:
      help_link: null
      hresult: -2146233078
      inner_exception: null
      message: Security error.
      source: System.Management.Automation
      type: System.Security.SecurityException
    fully_qualified_error_id: ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
    output: |-
      Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a
      policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution
      policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information
      please see "Get-Help Set-ExecutionPolicy".
      At line:1 char:1
      + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
          + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
    pipeline_iteration_info: []
    script_stack_trace: 'at <ScriptBlock>, <No file>: line 1'
    target_object: null
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
  output: []
  result: {}
  verbose: []
  warning: []

TASK [dell_endpoints_bios : Install Module] ****************************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:14
Thursday 01 September 2022  14:04:03 -0500 (0:00:02.181)       0:00:12.290 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error: []
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        Find-Module -Name DellBIOSProvider | Install-Module -Force
  output: []
  result: {}
  verbose: []
  warning: []

TASK [dell_endpoints_bios : Verify that the module is available along with the available exported commands] ************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:19
Thursday 01 September 2022  14:04:15 -0500 (0:00:12.073)       0:00:24.364 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  cmd: Get-Module -ListAvailable
  delta: '0:00:02.723894'
  end: '2022-09-01 19:04:19.790134'
  rc: 0
  start: '2022-09-01 19:04:17.066240'
  stderr: ''
  stderr_lines: <omitted>
  stdout: |2-

        Directory: C:\Program Files\WindowsPowerShell\Modules

    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Binary     2.6.0      DellBIOSProvider                    {Set-Dell1stBootdevice, Set-DellAutoOnForSelectDays, Get-D...
    Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
    Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
    Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
    Script     3.4.0      Pester                              {Describe, Context, It, Should...}
    Script     2.2.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
    Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
    Script     3.3.2      Pscx                                {Add-PathVariable, Clear-MSMQueue, ConvertFrom-Base64, Con...
    Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remov...

        Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules

    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgro...
    Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-Ap...
    Manifest   1.0.0.0    AppvClient                          {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add...
    Manifest   2.0.1.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest...
    Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAcc...
    Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Re...
    Manifest   2.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Re...
    Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disa...
    Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance,...
    Manifest   1.0        ConfigCI                            {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIP...
    Manifest   1.0        ConfigDefender                      {Get-MpPreference, Set-MpPreference, Add-MpPreference, Rem...
    Manifest   1.0        ConfigDefenderPerformance           {New-MpPerformanceRecording, Get-MpPerformanceReport}
    Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Rem...
    Manifest   1.0.2.0    DeliveryOptimization                {Delete-DeliveryOptimizationCache, Set-DeliveryOptimizatio...
    Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAManualEntry...
    Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-Window...
    Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get...
    Manifest   1.0.0.0    EventTracingManagement              {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceS...
    Manifest   1.0.0.1    HostNetworkingService               {Remove-HnsNamespace, Remove-HnsEndpoint, Get-HnsEndpoint,...
    Manifest   2.0.0.0    International                       {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMet...
    Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-Iscs...
    Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
    Manifest   1.0.0.0    Kds                                 {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsC...
    Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}
    Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...
    Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}
    Manifest   1.0.0.0    Microsoft.PowerShell.LocalAccounts  {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser...
    Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...
    Script     1.0        Microsoft.PowerShell.ODataUtils     Export-ODataEndpointProxy
    Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
    Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}
    Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredS...
    Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...
    Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTrans...
    Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-Ne...
    Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProfile}
    Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEvent...
    Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTea...
    Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMa...
    Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, ...
    Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPse...
    Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTea...
    Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol...
    Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Rese...
    Manifest   1.0.0.0    NetworkSwitchManager                {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEt...
    Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfig...
    Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restar...
    Binary     1.0.0.0    PersistentMemory                    {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegio...
    Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-Certificate...
    Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, D...
    Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-Prin...
    Binary     1.0.12     ProcessMitigations                  {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-P...
    Script     3.0        Provisioning                        {Install-ProvisioningPackage, Export-ProvisioningPackage, ...
    Manifest   1.1        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConfiguration,...
    Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WS...
    Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-Jo...
    Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}
    Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow
    Manifest   1.0.0.0    ScheduledTasks                      {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledT...
    Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBoo...
    Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbSha...
    Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...
    Manifest   1.0.0.2    StartLayout                         {Export-StartLayout, Import-StartLayout, Export-StartLayou...
    Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add...
    Manifest   1.0.0.0    StorageBusCache                     {Clear-StorageBusDisk, Disable-StorageBusCache, Disable-St...
    Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disa...
    Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
    Manifest   2.0.0.0    TrustedPlatformModule               {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}
    Binary     2.1.639.0  UEV                                 {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-Uev...
    Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnectio...
    Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}
    Manifest   2.0.0.0    Whea                                {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}
    Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperL...
    Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsErrorReporti...
    Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
    Manifest   1.0.0.0    WindowsUpdate                       Get-WindowsUpdateLog
  stdout_lines: <omitted>

TASK [dell_endpoints_bios : Create module directory if it does not exist] **********************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:22
Thursday 01 September 2022  14:04:20 -0500 (0:00:04.439)       0:00:28.804 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error: []
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        If (-NOT (Test-Path "${env:ProgramFiles}\WindowsPowerShell\Modules")) {
          New-Item -Path "${env:ProgramFiles}\WindowsPowerShell\Modules" -ItemType "directory" -Force }
  output: []
  result: {}
  verbose: []
  warning: []
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy

TASK [dell_endpoints_bios : Copy ps script to host] ********************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:29
Thursday 01 September 2022  14:04:22 -0500 (0:00:02.146)       0:00:30.950 ****
redirecting (type: modules) ansible.builtin.win_copy to ansible.windows.win_copy
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_copy.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
ok: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=false
  checksum: f20d46061a1a3b7304ab17426bc65ea58b0acf73
  dest: C:\Ansible
  operation: file_copy
  original_basename: psmodule.ps1
  size: 60
  src: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/library/psmodule.ps1
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy

TASK [dell_endpoints_bios : Copy PsExec] *******************************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:46
Thursday 01 September 2022  14:04:23 -0500 (0:00:01.105)       0:00:32.055 ****
redirecting (type: modules) ansible.builtin.win_copy to ansible.windows.win_copy
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy
redirecting (type: action) ansible.builtin.win_copy to ansible.windows.win_copy
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_copy.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
ok: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=false
  checksum: null
  dest: C:\Ansible
  operation: file_copy
  original_basename: PsExec.exe
  size: 339096
  src: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/files/PsExec.exe

TASK [dell_endpoints_bios : Run powershell as a specific admin user] ***************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:52
Thursday 01 September 2022  14:04:24 -0500 (0:00:01.057)       0:00:33.113 ****
redirecting (type: modules) ansible.builtin.win_psexec to community.windows.win_psexec
redirecting (type: modules) ansible.builtin.win_psexec to community.windows.win_psexec
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/community/windows/plugins/modules/win_psexec.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  delta: '0:00:07.779864'
  end: '2022-09-01 07:04:33.736243'
  invocation:
    module_args:
      chdir: null
      command: powershell.exe -executionpolicy bypass -noninteractive -nologo -Command "Import-Module -Name DellBIOSProvider -Verbose -Force"
      elevated: true
      executable: C:\Ansible\PsExec.exe
      hostnames: null
      interactive: false
      limited: false
      nobanner: true
      noprofile: false
      password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
      priority: null
      session: null
      system: false
      timeout: null
      username: local-admin
      wait: true
  psexec_command: C:\Ansible\PsExec.exe -nobanner -u local-admin -p *PASSWORD_REPLACED* -h -accepteula powershell.exe -executionpolicy bypass -noninteractive -nologo -Command "Import-Module -Name DellBIOSProvider -Verbose -Force"
  rc: 0
  start: '2022-09-01 07:04:25.956379'
  stderr: |-
    Connecting to local system...Starting PSEXESVC service on local system...Connecting with PsExec service on DELL-D9B1L63...Starting powershell.exe on DELL-D9B1L63...
    powershell.exe exited on DELL-D9B1L63 with error code 0.
  stderr_lines: <omitted>
  stdout: |-
    VERBOSE: Loading module from path 'C:\Program
    Files\WindowsPowerShell\Modules\DellBIOSProvider\2.6.0\DellBIOSProvider.psd1'.
  stdout_lines: <omitted>

TASK [dell_endpoints_bios : Verify the import for DellSMBIOS] **********************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:114
Thursday 01 September 2022  14:04:33 -0500 (0:00:09.446)       0:00:42.559 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  cmd: Get-PSDrive
  delta: '0:00:00.918242'
  end: '2022-09-01 19:04:37.609541'
  rc: 0
  start: '2022-09-01 19:04:36.691299'
  stderr: ''
  stderr_lines: <omitted>
  stdout: |2-

    Name           Used (GB)     Free (GB) Provider      Root                                CurrentLoc
                                                                                                  ation
    ----           ---------     --------- --------      ----                                ----------
    Alias                                  Alias
    C                  93.98        359.30 FileSystem    C:\                                    Windows
    Cert                                   Certificate   \
    Env                                    Environment
    Function                               Function
    HKCU                                   Registry      HKEY_CURRENT_USER
    HKLM                                   Registry      HKEY_LOCAL_MACHINE
    Variable                               Variable
    WSMan                                  WSMan
  stdout_lines: <omitted>

TASK [dell_endpoints_bios : Set location for working with module] ******************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:120
Thursday 01 September 2022  14:04:37 -0500 (0:00:03.918)       0:00:46.478 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error:
  - category_info:
      activity: Set-Location
      category: ObjectNotFound
      category_id: 13
      reason: DriveNotFoundException
      target_name: delldmbios
      target_type: String
    error_details: null
    exception:
      help_link: null
      hresult: -2146233087
      inner_exception: null
      message: Cannot find drive. A drive with the name 'delldmbios' does not exist.
      source: System.Management.Automation
      type: System.Management.Automation.DriveNotFoundException
    fully_qualified_error_id: DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    output: |-
      Set-Location : Cannot find drive. A drive with the name 'delldmbios' does not exist.
      At line:1 char:1
      + Set-Location -Path "delldmbios:"
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (delldmbios:String) [Set-Location], DriveNotFoundException
          + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    pipeline_iteration_info:
    - 0
    - 1
    script_stack_trace: 'at <ScriptBlock>, <No file>: line 1'
    target_object: delldmbios
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        Set-Location -Path "delldmbios:"
  output: []
  result: {}
  verbose: []
  warning: []

TASK [dell_endpoints_bios : Verify BIOS mutating admin password is set or not set] *************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:180
Thursday 01 September 2022  14:04:41 -0500 (0:00:03.690)       0:00:50.169 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error:
  - category_info:
      activity: Get-Item
      category: ObjectNotFound
      category_id: 13
      reason: DriveNotFoundException
      target_name: Dellsmbios
      target_type: String
    error_details: null
    exception:
      help_link: null
      hresult: -2146233087
      inner_exception: null
      message: Cannot find drive. A drive with the name 'Dellsmbios' does not exist.
      source: System.Management.Automation
      type: System.Management.Automation.DriveNotFoundException
    fully_qualified_error_id: DriveNotFound,Microsoft.PowerShell.Commands.GetItemCommand
    output: |-
      Get-Item : Cannot find drive. A drive with the name 'Dellsmbios' does not exist.
      At line:1 char:1
      + Get-Item -Path Dellsmbios:\Security\IsAdminPasswordSet
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Dellsmbios:String) [Get-Item], DriveNotFoundException
          + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetItemCommand
    pipeline_iteration_info:
    - 0
    - 1
    script_stack_trace: 'at <ScriptBlock>, <No file>: line 1'
    target_object: Dellsmbios
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        Get-Item -Path Dellsmbios:\Security\IsAdminPasswordSet
  output: []
  result: {}
  verbose: []
  warning: []

TASK [dell_endpoints_bios : Clear admin password] **********************************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:190
Thursday 01 September 2022  14:04:45 -0500 (0:00:03.731)       0:00:53.901 ****
Loading collection amazon.aws from /home/arichardson.sa/.ansible/collections/ansible_collections/amazon/aws
AWS_ssm name lookup term: ['/Striveworks-Role-IT/dellsmbios']
AWS_ssm path lookup returning: ['^nkY57(85]m']
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error:
  - category_info:
      activity: Set-Item
      category: InvalidArgument
      category_id: 5
      reason: ParameterBindingException
      target_name: ''
      target_type: ''
    error_details: null
    exception:
      help_link: null
      hresult: -2146233087
      inner_exception: null
      message: A parameter cannot be found that matches parameter name 'Password'.
      source: System.Management.Automation
      type: System.Management.Automation.ParameterBindingException
    fully_qualified_error_id: NamedParameterNotFound,Microsoft.PowerShell.Commands.SetItemCommand
    output: |-
      Set-Item : A parameter cannot be found that matches parameter name 'Password'.
      At line:7 char:54
      + ... et-Item -Path DellSmbios:\Security\AdminPassword "" -Password "Strive ...
      +                                                         ~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Set-Item], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetItemCommand
    pipeline_iteration_info: []
    script_stack_trace: 'at <ScriptBlock>, <No file>: line 7'
    target_object: null
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters:
        AdminPwd: ^nkY57(85]m
      removes: null
      script: |-
        [CmdletBinding()]
        param (
            [String]
            $AdminPwd
        )

        Set-Item -Path DellSmbios:\Security\AdminPassword "" -Password "Striveworks"
  output: []
  result: {}
  verbose: []
  warning: []

TASK [dell_endpoints_bios : Configure battery charging state] **********************************************************************************************task path: /home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:207
Thursday 01 September 2022  14:04:49 -0500 (0:00:04.265)       0:00:58.166 ****
Using module file /usr/local/share/ansible-venv/lib/python3.9/site-packages/ansible_collections/ansible/windows/plugins/modules/win_powershell.ps1
Pipelining is enabled.
<DELL-D9B1L63.america.striveworks.us> ESTABLISH WINRM CONNECTION FOR USER: arichardson.sa@AMERICA.STRIVEWORKS.US on PORT 5986 TO DELL-D9B1L63.america.striveworks.us
EXEC (via pipeline wrapper)
changed: [it.loaner_DELL-D9B1L63.america.striveworks.us] => changed=true
  debug: []
  error:
  - category_info:
      activity: Set-Item
      category: ObjectNotFound
      category_id: 13
      reason: DriveNotFoundException
      target_name: DellSmbios
      target_type: String
    error_details: null
    exception:
      help_link: null
      hresult: -2146233087
      inner_exception: null
      message: Cannot find drive. A drive with the name 'DellSmbios' does not exist.
      source: System.Management.Automation
      type: System.Management.Automation.DriveNotFoundException
    fully_qualified_error_id: DriveNotFound,Microsoft.PowerShell.Commands.SetItemCommand
    output: |-
      Set-Item : Cannot find drive. A drive with the name 'DellSmbios' does not exist.
      At line:1 char:1
      + Set-Item -Path DellSmbios:\PowerManagement\PrimaryBattChargeCfg "Prim ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (DellSmbios:String) [Set-Item], DriveNotFoundException
          + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetItemCommand
    pipeline_iteration_info:
    - 0
    - 1
    script_stack_trace: 'at <ScriptBlock>, <No file>: line 1'
    target_object: DellSmbios
  host_err: ''
  host_out: ''
  information: []
  invocation:
    module_args:
      arguments: null
      chdir: null
      creates: null
      depth: 2
      error_action: continue
      executable: null
      parameters: null
      removes: null
      script: |-
        Set-Item -Path DellSmbios:\PowerManagement\PrimaryBattChargeCfg "PrimACUse"
  output: []
  result: {}
  verbose: []
  warning: []
META: role_complete for it.loaner_DELL-D9B1L63.america.striveworks.us
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************it.loaner_DELL-D9B1L63.america.striveworks.us : ok=13   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
localhost                  : ok=11   changed=1    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0

Thursday 01 September 2022  14:04:54 -0500 (0:00:05.468)       0:01:03.635 ****
===============================================================================
dell_endpoints_bios : Install Module --------------------------------------------------------------------------------------------------------------- 12.07s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:14 ------------------------------------------------------------------------
dell_endpoints_bios : Run powershell as a specific admin user --------------------------------------------------------------------------------------- 9.45s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:52 ------------------------------------------------------------------------
dell_endpoints_bios : Configure battery charging state ---------------------------------------------------------------------------------------------- 5.47s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:207 -----------------------------------------------------------------------
dell_endpoints_bios : Verify that the module is available along with the available exported commands ------------------------------------------------ 4.44s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:19 ------------------------------------------------------------------------
dell_endpoints_bios : Clear admin password ---------------------------------------------------------------------------------------------------------- 4.27s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:190 -----------------------------------------------------------------------
dell_endpoints_bios : Verify the import for DellSMBIOS ---------------------------------------------------------------------------------------------- 3.92s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:114 -----------------------------------------------------------------------
dell_endpoints_bios : Verify BIOS mutating admin password is set or not set ------------------------------------------------------------------------- 3.73s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:180 -----------------------------------------------------------------------
dell_endpoints_bios : Set location for working with module ------------------------------------------------------------------------------------------ 3.69s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:120 -----------------------------------------------------------------------
Gathering Facts ------------------------------------------------------------------------------------------------------------------------------------- 2.84s
/home/arichardson.sa/monorepo/ansible/configure_endpoints_bios.yaml:6 -------------------------------------------------------------------------------------
dell_endpoints_bios : Set Execution policy ---------------------------------------------------------------------------------------------------------- 2.18s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:9 -------------------------------------------------------------------------
dell_endpoints_bios : Create module directory if it does not exist ---------------------------------------------------------------------------------- 2.15s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:22 ------------------------------------------------------------------------
maas360_inventory : Add MaaS360 hosts to Ansible inventory ------------------------------------------------------------------------------------------ 1.95s
/home/arichardson.sa/monorepo/ansible/roles/maas360_inventory/tasks/main.yaml:186 -------------------------------------------------------------------------
dell_endpoints_bios : Copy ps script to host -------------------------------------------------------------------------------------------------------- 1.11s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:29 ------------------------------------------------------------------------
dell_endpoints_bios : Copy PsExec ------------------------------------------------------------------------------------------------------------------- 1.06s
/home/arichardson.sa/monorepo/ansible/roles/dell_endpoints_bios/tasks/main.yaml:46 ------------------------------------------------------------------------
Gathering Facts ------------------------------------------------------------------------------------------------------------------------------------- 0.92s
/home/arichardson.sa/monorepo/ansible/aws_creds.yaml:1 ----------------------------------------------------------------------------------------------------
aws_creds : Fetch MFA devices ----------------------------------------------------------------------------------------------------------------------- 0.90s
/home/arichardson.sa/monorepo/ansible/roles/aws_creds/tasks/main.yaml:21 ----------------------------------------------------------------------------------
maas360_inventory : query MaaS360 for devices ------------------------------------------------------------------------------------------------------- 0.78s
/home/arichardson.sa/monorepo/ansible/roles/maas360_inventory/tasks/main.yaml:161 -------------------------------------------------------------------------
aws_creds : Check for AWS config -------------------------------------------------------------------------------------------------------------------- 0.66s
/home/arichardson.sa/monorepo/ansible/roles/aws_creds/tasks/main.yaml:5 -----------------------------------------------------------------------------------
Gathering Facts ------------------------------------------------------------------------------------------------------------------------------------- 0.63s
/home/arichardson.sa/monorepo/ansible/maas360_inventory.yaml:3 --------------------------------------------------------------------------------------------
aws_creds : Get current token expiration ------------------------------------------------------------------------------------------------------------ 0.61s
/home/arichardson.sa/monorepo/ansible/roles/aws_creds/tasks/main.yaml:30 ----------------------------------------------------------------------------------

Code of Conduct

ansibot commented 2 years ago

Files identified in the description: None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot commented 2 years ago

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see: https://github.com/ansible/ansibullbot/blob/devel/docs/collection_migration.md

sysnetstriver commented 2 years ago

The psexec module is not the problem. That was just an additional attempt to get it to work. The primary problem is ansible.windows.win_powershell and ansible.windows.win_shell.