Question
A security analyst recently joined the team and is trying to determine which scripting language is being used in a production script to determine if it is malicious. Given the following script:
```
foreach ($user in Get-Content .\this.txt)
{
Get-ADUser $user -Properties primaryGroupID |select-object primaryGroupID
Add-ADGroupMember "Domain Users" -Members $user
Set-ADUser $user -Replace @{primaryGroupID=513}
}
```
Which of the following scripting languages was used in the script?
- A. PowerShell Correct
- B. Ruby
- C. Python
- D. Shell script
Explanation
The script uses PowerShell verb-noun cmdlets (Get-Content, Get-ADUser, Add-ADGroupMember, Set-ADUser, Select-Object), $-prefixed variables, the pipeline into Select-Object and the @{} hashtable syntax, all of which are PowerShell. Ruby and Python do not use these cmdlets or $variable syntax, and a Unix shell script would not call Active Directory cmdlets or use @{} hashtables.