# Powershell ISE, Get-AdGroup does not run when started as admin

**URL:** <https://forums.powershell.org/t/powershell-ise-get-adgroup-does-not-run-when-started-as-admin/21610>\
**Category:** PowerShell Help\
**Created:** [February 10, 2023, 9:36am UTC](https://forums.powershell.org/t/powershell-ise-get-adgroup-does-not-run-when-started-as-admin/21610 "2023-02-10T09:36:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tent1987](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tent1987](https://forums.powershell.org/u/Tent1987)\
**Post date:** [February 10, 2023, 9:36am UTC](https://forums.powershell.org/t/powershell-ise-get-adgroup-does-not-run-when-started-as-admin/21610/1 "2023-02-10T09:36:57Z")

</div>

**When i start ISE as admin i run this code:**  
$Domain = “[contoso.com](http://contoso.com)”  
Get-ADGroup -Identity “Contoso-Windows” -server $Domain

It does not give any results.

**When i start ISE normally and run:**  
$Domain = “[contoso.com](http://contoso.com)”  
Get-ADGroup -Identity “Contoso-Windows” -server $Domain

It gives me back the group name and its properties.

Any one else with this problem? Or with a fix?

---

<div class="post-metadata">

**Author:** ![Scott\_Post](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/scott_post/32/5068_2.png) [@Scott\_Post](https://forums.powershell.org/u/Scott_Post)\
**Post date:** [December 10, 2023, 4:14am UTC](https://forums.powershell.org/t/powershell-ise-get-adgroup-does-not-run-when-started-as-admin/21610/2 "2023-12-10T04:14:07Z")

</div>

When you are running as admin, is this the local machine administrator account? If so, three problem may be that it doesn’t have rights to read from the domain.

As it works with your account, i can only guess that it is a domain account logged into the computer.

That being said, if need alternate credentials for making changes to AD groups, check out the Get-Credential command.

```auto
$creds = Get-Credential
$domain = "contoso.com"
Get-ADGroup -identity "Contoso-Windows" -server $domain -credentials $creds

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [February 7, 2024, 6:27am UTC](https://forums.powershell.org/t/powershell-ise-get-adgroup-does-not-run-when-started-as-admin/21610/3 "2024-02-07T06:27:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
