Skip to content

Instantly share code, notes, and snippets.

View ProgrammingWithHandGrenades's full-sized avatar

ProgrammingWithHandGrenades

View GitHub Profile
@ProgrammingWithHandGrenades
ProgrammingWithHandGrenades / March 2016 Scripting Games
Created March 18, 2016 15:14
March 2016 Scripting Games Solution demonstrating regex character class subtraction.
Get-ChildItem \\servername\sharename -Recurse -Force |
Where { $_.Name -match '[\u00C0-\u00FF -[\u00D7\u00F7]]'} |
ForEach-Object {[PSCustomObject]@{Name=$_.Name;Directory=$_.Directory;'Creation Date'=$_.CreationTime;'Last Modification Date'=$_.LastWriteTime;'File Size'=$_.Length} } |
Format-Table -AutoSize
@ProgrammingWithHandGrenades
ProgrammingWithHandGrenades / gist:0a9b13e36b5176e18c85
Created September 7, 2015 13:41
September Scripting Games puzzle solution. One line, no semicolons, no curly braces.
Import-Csv .\input.csv | Add-Member -MemberType ScriptProperty -Name 'OSVersion' -Value $([scriptblock]::create('(Get-WmiObject Win32_OperatingSystem -ComputerName $this.MachineName).caption' )) -PassThru | Export-Csv output.csv -NoTypeInformation