Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cfbs.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@
"bundles inventory_unshadowed_users:main"
]
},
"inventory-windows-services": {
"description": "Inventory running Windows services.",
"subdirectory": "inventory",
"steps": [
"copy inventory-windows-services.cf services/cfbs/inventory-windows-services/",
"policy_files services/cfbs/inventory-windows-services/",
"bundles inventory_windows_services_running"
]
},
"library-for-promise-types-in-bash": {
"description": "Library enabling promise types implemented in bash.",
"subdirectory": "libraries/bash",
Expand Down
28 changes: 28 additions & 0 deletions inventory/inventory-windows-services.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bundle agent inventory_windows_services_running
# @brief Inventory Windows services that are running
# @inventory Windows services running
{
vars:
windows::
"_cache" string => "$(sys.statedir)/windows-services-running.json";

"_data" data => readjson("$(_cache)");
"_indices" slist => getindices(_data);

"i[$(_indices)]"
string => "$(_data[$(_indices)][DisplayName])",
meta => { "inventory", "attribute_name=Windows services running"};


commands:
windows::
"Get-Service | Where-Object {$_.Status -eq 'Running'} | ConvertTo-Json | Set-Content -Path '${_cache}'"
contain => powershell;

}

bundle agent __main__
{
methods:
"inventory_windows_services_running";
}