Question: Whats the best/easiest way to test for administrative rights in a PowerShell script?

I need to write a script that requires administrative rights and want to know the best way to achieve it.

Answer: 
FYI, for those folks that have the [PowerShell Community Extensions](http://pscx.codeplex.com) installed:

```
PS> Test-UserGroupMembership -GroupName Administrators
True

```

This cmdlet is a bit more generic in that you can test for group membership in any group.
Check out this url: <http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx>

I didn't test it but the summary seems to state what you are looking for: "Learn how to check for administrative credentials when you run a Windows PowerShell script or command."