Hello Jordan,
Thank you very mutch. I had the same raissonement with a custom script.
Yesterday, i created a specifical script to ckeck a groups.
function Get-AdministratorsGroupName {
$LocalGroup = @('Administrators', 'Administrateurs', 'Domain Admins')
foreach ($Group in $LocalGroup){
Try{
if(([adsi]"WinNT://./$Group,group").psbase.Invoke('Members')){
return $Group
}
} catch {}
}
}
Get-AdministratorsGroupName
Regards
Le lundi 10 juillet 2017 22:41:57 UTC+2, Jordan Borean a écrit :
>
> Hey
>
> One thing you can do is use the win_region module
> https://docs.ansible.com/ansible/win_region_module.html to change the
> region of your hosts to a common value. If this isn't what you can do, you
> can also run an adhoc command to determine the group name based on the SID.
> Give the below tasks a shot and see if it returns what you are looking for.
>
> - name: get group name from sid
>> win_command: powershell.exe "((New-Object
>> System.Security.Principal.SecurityIdentifier('S-1-5-32-544')).Translate([System.Security.Principal.NTAccount]).Value
>>
>> -split '\\')[1]"
>> register: admin_group
>
> - debug:
>> var: admin_group.stdout_lines[0]
>
>
> It looks up the group name based on the SID 'S-1-5-32-544' which is the
> default SID for the local administrators group and should be consistent
> across all Windows OS'.
>
> Thanks
>
> Jordan
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/485b3cb2-b309-4031-9268-14ae36260fcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.