This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$driveLetters = Get-Volume | Select -ExpandProperty driveLetter | |
foreach ($driveLetter in $driveLetters) { | |
Get-CimInstance CIM_LogicalDiskBasedOnPartition | | |
Where-Object {$_.Dependent -like "*DeviceID = `"$driveLetter`:`"*"} | | |
Select @{l='DriveLetter';e={$driveLetter}},@{l='Index';e={$_.Antecedent -match "Disk #[\d]+" | | |
ForEach-Object {$matches[0]}}} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$myString = 'Hint: abcdefghijklmnopqrstuvwxyz' | |
$myString -match 'Hint: (?<hint>.{0,20})' | |
$matches.hint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tables = Get-Content c:\tables.txt | |
$tables = $tables -replace '<table>\s*<\/table>','foo' | |
Write-Output $tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$list = @" | |
1 Partridge in a pear tree | |
2 Turtle Doves | |
3 French Hens | |
4 Calling Birds | |
5 Golden Rings | |
6 Geese a laying | |
7 Swans a swimming | |
8 Maids a milking | |
9 Ladies dancing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Author: Matt Bloomfield | |
#Date: 2015-11-03 | |
#First attempt at some basic obfuscation.. | |
'87!114!105!116!101!45!72!111!115!116!32!39!74!117!115!116!32!65!110!111!1'+ | |
'16!104!101!114!32!80!111!119!101!114!83!104!101!108!108!32!69!110!116!104'+ | |
'!117!115!105!97!115!116!44!39' -split '!' | %{$s += -join [char][byte]$_}; | |
iex $s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while ($true){ | |
($computer = Read-Host 'Enter a computer name or ctrl + c to quit'), | |
(($os = gwmi Win32_OperatingSystem -co $computer),($bios = gwmi Win32_bios -co $computer) | Out-Null), | |
(New-Object -t PSObject | Add-Member -m NoteProperty -na PSComputerName -va $os.PSComputerName -pa | | |
Add-Member -m NoteProperty -na ServicePackMajorVersion -va $os.ServicePackMajorVersion -pa | | |
Add-Member -m NoteProperty -na Version -va $os.Version -pa | | |
Add-Member -m NoteProperty -na BIOSSerial -va $bios.SerialNumber -pa | ft -a)} |