So here is the script that I am trying to do. rough form of it is
query installed programs
get display name and target_exe
add to variable to be returned by module
iterate over returned paths and do win_file_version on target_exe
Rough code as of now is...
#!powershell
# WANT_JSON
# POWERSHELL_COMMON
$path = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
$items = Get-ChildItem -Recurse -Path $path -Include *.lnk
$Shell = New-Object -ComObject WScript.Shell
$result = @{
changed = $false
installed_progs = @{}
}
$intalled_programs = New-Object System.Collections.Arraylist
foreach ($item in $items) {
$object = new-object psobject @{
name = $item.BaseName.tolower()
path = $Shell.CreateShortcut($item).targetpath.tolower()
}
if ($object.path.endswith('exe')) {
$result.installed_progs.add($item.BaseName.toLower(),
$Shell.CreateShortcut($item).targetpath.tolower())
}
}
[Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null
Exit-Json $result
--
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/da10479d-25b3-49ce-997d-549707ca82af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.