You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **Get-GPO** cmdlet gets one Group Policy Object (GPO) or all the GPOs in a domain.
35
-
You can specify a GPO by its display name or by its globally unique identifier (GUID) to get a single GPO, or you can get all the GPOs in the domain through the *All* parameter.
37
+
38
+
The `Get-GPO` cmdlet gets one Group Policy Object (GPO) or all the GPOs in a domain.
39
+
You can specify a GPO by its display name or by its globally unique identifier (GUID) to get a
40
+
single GPO, or you can get all the GPOs in the domain through the **All** parameter.
36
41
37
42
This cmdlet returns one or more objects that represent the requested GPOs.
38
-
By default, properties of the requested GPOs are printed to the display; however, you can also pipe the output of the **Get-GPO** cmdlet to other Group Policy cmdlets.
43
+
By default, properties of the requested GPOs are printed to the display; however, you can also pipe
44
+
the output of the `Get-GPO` cmdlet to other Group Policy cmdlets.
39
45
40
46
## EXAMPLES
41
47
42
48
### Example 1: Get a single GPO from a domain
49
+
50
+
```powershell
51
+
Get-GPO -Name "Group Policy Test"
52
+
```
53
+
43
54
```
44
-
PS C:\> Get-GPO -Name "Group Policy Test"
45
55
DisplayName : Group Policy Test
46
56
47
57
DomainName : contoso.com
@@ -66,12 +76,17 @@ WmiFilter :
66
76
```
67
77
68
78
This command gets the GPO named Group Policy Test.
69
-
The GPO must exist in the domain of the user that is running the session (or, for startup and shutdown scripts, the computer).
79
+
The GPO must exist in the domain of the user that is running the session (or, for startup and
80
+
shutdown scripts, the computer).
70
81
The command gets the GPO information by contacting the primary domain controller (PDC).
This command gets the GPO that has the ID (GUID) 331a09564-cd4a-4520-98fa-446a2af23b4b in the sales.contoso.com domain.
99
-
If the domain of the user that is running the session (or, for startup and shutdown scripts, the computer) is different that sales.contoso.com, a trust must exist between the two domains.
100
-
The command retrieves the GPO information by contacting the PDC (in the sales.contoso.com domain).
113
+
This command gets the GPO that has the ID (GUID) `331a09564-cd4a-4520-98fa-446a2af23b4b` in the
114
+
`sales.contoso.com` domain.
115
+
If the domain of the user that is running the session (or, for startup and shutdown scripts, the
116
+
computer) is different than `sales.contoso.com`, a trust must exist between the two domains.
117
+
The command retrieves the GPO information by contacting the PDC (in the `sales.contoso.com` domain).
101
118
102
119
### Example 3: Get all GPOs from a domain
103
-
```
104
-
PS C:\> Get-GPO -All -Domain "sales.contoso.com"
120
+
121
+
```powershell
122
+
Get-GPO -All -Domain "sales.contoso.com"
105
123
```
106
124
107
125
This command get all the GPOs in the sales.contoso.com domain.
108
126
109
127
## PARAMETERS
110
128
111
129
### -All
130
+
112
131
Indicates that the cmdlet gets all the GPOs in the domain.
You must specify the fully qualified domain name (FQDN) of the domain.
129
149
130
-
For the **Get-GPO** cmdlet, the GPO (or GPOs) to that this cmdlet gets must exist in this domain.
150
+
For the `Get-GPO` cmdlet, the GPO (or GPOs) to that this cmdlet gets must exist in this domain.
131
151
132
-
If you do not specify the *Domain* parameter, the domain of the user that is running the current session is used.
133
-
If the cmdlet is being run from a computer startup or shutdown script, the domain of the computer is used.
152
+
If you do not specify the **Domain** parameter, the domain of the user that is running the current
153
+
session is used.
154
+
If the cmdlet is being run from a computer startup or shutdown script, the domain of the computer
155
+
is used.
134
156
For more information, see the Notes section in the full Help.
135
157
136
-
If you specify a domain that is different from the domain of the user that is running the current session (or, for a startup or shutdown script, the computer), a trust must exist between that domain and the domain of the user or the computer.
158
+
If you specify a domain that is different from the domain of the user that is running the current
159
+
session (or, for a startup or shutdown script, the computer), a trust must exist between that
160
+
domain and the domain of the user or the computer.
137
161
138
-
You can also refer to the *Domain* parameter by its built-in alias, domainname.
139
-
For more information, see about_Aliases.
162
+
You can also refer to the **Domain** parameter by its built-in alias, **domainname.**
163
+
For more information, see [about_Aliases](/powershell/module/microsoft.powershell.core/about/about_aliases).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
241
+
242
+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
214
246
215
247
## INPUTS
216
248
217
249
### Microsoft.GroupPolicy.Gpo
250
+
218
251
You can pipe a GPO for which to get information to this cmdlet.
219
252
You can pipe GPO objects into this cmdlet to display information about the GPOs.
220
253
Collections that contain GPOs from different domains are not supported.
221
254
222
255
## OUTPUTS
223
256
224
257
### Microsoft.GroupPolicy.Gpo
258
+
225
259
This cmdlet returns an object that represents the requested GPO.
226
260
227
261
## NOTES
228
-
* You can use the *Domain* parameter to explicitly specify the domain for this cmdlet.
229
-
230
-
If you do not explicitly specify the domain, the cmdlet uses a default domain.
231
-
The default domain is the domain that is used to access network resources by the security context under which the current session is running.
232
-
This domain is typically the domain of the user that is running the session.
233
-
For example, the domain of the user who started the session by opening Windows PowerShell from the Program Files menu, or the domain of a user that is specified in a runas command.
234
-
However, computer startup and shutdown scripts run under the context of the LocalSystem account.
235
-
The LocalSystem account is a built-in local account, and it accesses network resources under the context of the computer account.
236
-
Therefore, when this cmdlet is run from a startup or shutdown script, the default domain is the domain to which the computer is joined.
237
-
238
-
Only one domain can be used by an instance of this cmdlet.
239
-
If you pipe a collection of GPO (Microsoft.GroupPolicy.Gpo) objects to this cmdlet, the DomainName property of the first GPO object in the collection specifies the domain for the cmdlet.
240
-
This is because domainname is a built-in alias for the *Domain* parameter, and the *Domain* parameter can take its value by property name from the pipeline.
241
-
A non-terminating error occurs for any GPOs in the collection that are not in this domain.
242
-
If this domain is different from the domain of the user account (for startup or shutdown scripts, the computer account), a trust must exist between the two domains.
262
+
263
+
- You can use the **Domain** parameter to explicitly specify the domain for this cmdlet.
264
+
265
+
If you do not explicitly specify the domain, the cmdlet uses a default domain. The default domain
266
+
is the domain that is used to access network resources by the security context under which the
267
+
current session is running. This domain is typically the domain of the user that is running the
268
+
session. For example, the domain of the user who started the session by opening Windows PowerShell
269
+
from the Program Files menu, or the domain of a user that is specified in a runas command.
270
+
However, computer startup and shutdown scripts run under the context of the LocalSystem account.
271
+
The LocalSystem account is a built-in local account, and it accesses network resources under the
272
+
context of the computer account. Therefore, when this cmdlet is run from a startup or shutdown
273
+
script, the default domain is the domain to which the computer is joined.
274
+
275
+
Only one domain can be used by an instance of this cmdlet. If you pipe a collection of GPO
276
+
(**Microsoft.GroupPolicy.Gpo**) objects to this cmdlet, the **DomainName** property of the first
277
+
GPO object in the collection specifies the domain for the cmdlet. This is because **domainname**
278
+
is a built-in alias for the **Domain** parameter, and the **Domain** parameter can take its value
279
+
by property name from the pipeline. A non-terminating error occurs for any GPOs in the collection
280
+
that are not in this domain. If this domain is different from the domain of the user account (for
281
+
startup or shutdown scripts, the computer account), a trust must exist between the two domains.
0 commit comments