Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-ReqServices
- {
- param
- (
- # Service you want recursive required services from
- [string]$service
- )
- $final_list = @()
- $final_list += (get-service $service).RequiredServices
- do
- {
- $check = $final_list.count
- foreach ($item in $final_list)
- {
- if(($item.RequiredServices).count -ne 0)
- {
- $final_list += (Compare-Object $final_list $item.RequiredServices | where {$_.sideindicator -eq "=>"}) | select inputobject -ExpandProperty inputobject
- }
- }
- }
- until ($check -eq $final_list.count)
- $final_list | select status,name,Displayname,RequiredServices | Sort-Object -Property Name
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement