From 16301d7e1f05b12f363584d6a0b6541d904d61f7 Mon Sep 17 00:00:00 2001 From: Chad Mills Date: Mon, 24 Oct 2016 15:33:51 -0600 Subject: [PATCH] Both win32_group and win32_useraccount would take upward of 5 minutes to complete on some systems, making it look like Nova was hanging. I have modifed both of these commands only look at local accounts, and it has sped up the proccess considerably --- hubblestack_nova/win_secedit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hubblestack_nova/win_secedit.py b/hubblestack_nova/win_secedit.py index c0dff8d..d1ce401 100644 --- a/hubblestack_nova/win_secedit.py +++ b/hubblestack_nova/win_secedit.py @@ -264,11 +264,13 @@ def _secedit_import(inf_file): def _get_account_sid(): '''This helper function will get all the users and groups on the computer and return a dictionary''' - win32 = __salt__['cmd.run']('Get-WmiObject win32_useraccount | Format-List -Property ' - 'Name, SID', shell='powershell', python_shell=True) + win32 = __salt__['cmd.run']('Get-WmiObject win32_useraccount -Filter "localaccount=\'True\'"' + ' | Format-List -Property Name, SID', shell='powershell', + python_shell=True) win32 += '\n' - win32 += __salt__['cmd.run']('Get-WmiObject win32_group | Format-List -Property Name, ' - 'SID', shell='powershell', python_shell=True) + win32 += __salt__['cmd.run']('Get-WmiObject win32_group -Filter "localaccount=\'True\'" | ' + 'Format-List -Property Name, SID', shell='powershell', + python_shell=True) if win32: dict_return = {}