Skip to content

Instantly share code, notes, and snippets.

@sz3n
Last active June 15, 2016 15:07
Show Gist options
  • Save sz3n/327a0d17d09da81bafed87db792aabe3 to your computer and use it in GitHub Desktop.
Save sz3n/327a0d17d09da81bafed87db792aabe3 to your computer and use it in GitHub Desktop.
Powershell Lab
#Lab architecture
Win7_dom - lab\domainpc
Win7 - workgroup
Win2008 - lab\domainsrv
Win2012 -Domain Controller
#Setup
vagrant init opentable/win-2012r2-standard-amd64-nocm; vagrant up --provider virtualbox
vagrant box add win7-ie11 http://aka.ms/vagrant-win7-ie11
vagrant init win7-ie11
vagrant init alexshd/windows_2008_r2_virtualbox; vagrant up --provider virtualbox
#http://blog.xebia.fr/2015/04/22/une-vm-moderne-pour-ie-avec-vagrant/
#Vagrant Config
#For Windows Guests it's necesary to put the following line into the config file:
config.vm.communicator = "winrm"
#Powershell Remoting
#Invoke-Command is not state-fully:
Invoke-Command -ScriptBlock { $procs=Get-Process } -ComputerName domainpc -Credential lab\domainpc
#The variable $procs is lost
Invoke-Command -ScriptBlock { $procs } -ComputerName domainpc -Credential lab\domainpc
#PSSession is state-fully
New-PSSession -ComputerName localhost -Credential vagrant
$sess = Get-PSSession
Invoke-Command -ScriptBlock {$procs = Get-Process} -Session $sess
Invoke-Command -ScriptBlock {$procs} -Session $sess
#Pentest AD
https://github.com/l3m0n/pentest_study
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment