> For the complete documentation index, see [llms.txt](https://omar-4.gitbook.io/omar-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://omar-4.gitbook.io/omar-docs/crtp-notes/ad-enumration/powerview-users-groups-and-computers.md).

# Powerview Users, groups and computers

**Get Information of domain controller**

```
Get-NetDomainController
Get-NetDomainController | select-object Name
```

**Get information of users in the domain**

```
Get-NetUser
Get-NetUser -Username <username>
```

**Get list of all users**

```
Get-NetUser | select samaccountname
```

**Get list of usernames, last logon and password last set**

```
Get-NetUser | select samaccountname, lastlogon, pwdlastset
Get-NetUser | select samaccountname, lastlogon, pwdlastset | Sort-Object -Property lastlogon
```

**Get list of usernames and their groups**

```
Get-NetUser | select samaccountname, memberof
```

**Get list of all properties for users in the current domain**

```
get-userproperty -Properties pwdlastset
```

**Get descripton field from the user**

```
Find-UserField -SearchField Description -SearchTerm "built"
Get-netuser | Select-Object samaccountname,description
```

**Get computer information**

```
Get-NetComputer
Get-NetComputer -FullData
Get-NetComputer -Computername <computername> -FullData
```

**Get computers with operating system ""**

```
Get-NetComputer -OperatingSystem "*Server 2016*"
```

**Get list of all computer names and operating systems**

```
Get-NetComputer -fulldata | select samaccountname, operatingsystem, operatingsystemversion
```

**List all groups of the domain**

```
Get-NetGroup
Get-NetGroup -GroupName *admin*
Get-NetGroup -Domain <domain>
```

**Get all the members of the group**

```
Get-NetGroupMember -Groupname "Domain Admins" -Recurse
Get-NetGroupMember -Groupname "Domain Admins" -Recurse | select MemberName
```

**Get the group membership of a user**

```
Get-NetGroup -Username <username>
```

**List all the local groups on a machine (needs admin privs on non dc machines)**

```
Get-NetlocalGroup -Computername <computername> -ListGroups
```

**Get Member of all the local groups on a machine (needs admin privs on non dc machines)**

```
Get-NetlocalGroup -Computername <computername> -Recurse
```

**Get actively logged users on a computer (needs local admin privs)**

```
Get-NetLoggedon -Computername <computername>
```

**Get locally logged users on a computer (needs remote registry rights on the target)**

```
Get-LoggedonLocal -Computername <computername>
```

**Get the last logged users on a computer (needs admin rights and remote registary on the target**

```
Get-LastLoggedOn -ComputerName <computername>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://omar-4.gitbook.io/omar-docs/crtp-notes/ad-enumration/powerview-users-groups-and-computers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
