From ef81bf9d275c30278f905f94c5f8e65938f99f57 Mon Sep 17 00:00:00 2001
From: kevinalbarton <kevin.albarton@gmail.com>
Date: Thu, 9 Jan 2020 23:14:25 +0330
Subject: [PATCH] Update PowerView.ps1

GetCurrentUserDomain encounter with:
Exception calling "GetCurrentUserDomain" with "0" argument(s): "Current security context is not associated with an Active
Directory domain or forest."
At line:1 char:1
+ [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ActiveDirectoryOperationException

In updated windows and .Net framework now but when changing to GetcomputerDomain while we have logged in with a domain user the problem will be resolved.
---
 Recon/PowerView.ps1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Recon/PowerView.ps1 b/Recon/PowerView.ps1
index d35a9f02..b9847f8e 100755
--- a/Recon/PowerView.ps1
+++ b/Recon/PowerView.ps1
@@ -2233,7 +2233,7 @@ filter Get-NetDomain {
         }
     }
     else {
-        [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
+        [System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()
     }
 }