Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Comment Based Help?

$
0
0

I am not sure what I am missing, but the help doesn't show up on this function that I created.  Any ideas on what I am missing?

Function Get-LocalAdmins{

    [CmdletBinding()]

    param(

    [Parameter()]

    [string]$ComputerName,

    $LocalGroupName = "administrators"

    )#params

 

    BEGIN{

        $Credential = Get-Credential dom\user

    }#begin

 

    PROCESS{

 

            Invoke-Command -ComputerName $computername -Credential $Credential -ScriptBlock { param($ComputerName,$LocalGroupName)

            #$localgroupname = "administrators"

            $group = [ADSI]"WinNT://$ComputerName/$LocalGroupName"

            $members = @($group.Invoke("Members")) |

             ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}

            "`n$LocalGroupName`n"

            $members

            } -ArgumentList $ComputerName,$LocalGroupName

    }#process

 

    END{}#end

<#

.SYNOPSIS 

Get a list of groups and uses for a local group on a computer.

.DESCRIPTION

Get a list of groups and uses of a local group on a computer, like the localadministrators group or the remote desktop users group.

.PARAMETER Computername

Enter the name of the computer you would like to access the local group.

.PARAMETER LocalGroupName

Enter the name of the local group the you want the member list from.  Adsministrators is default.

.INPUTS

None. 

You cannot pipe objects to Get-LocalAdmins.

.EXAMPLE

Get-LocalAdmins -ComputerName Servername -LocalGroupName "Remote Desktop Users"

#>

 

}#function

 

Get-Help Get-LocalAdmins -Full

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles