Skip to content

Instantly share code, notes, and snippets.

View turboBasic's full-sized avatar
🔮
Focusing

andriy melnyk turboBasic

🔮
Focusing
View GitHub Profile
@turboBasic
turboBasic / Get-NounsAndVerbsInPscx.txt
Last active September 9, 2017 00:18
[Get-NounsAndVerbsInPscx.txt] List of functions in Pscx module, arranged by noun #powershell #pscx
Noun Verbs
---- -----
ADObject Get
AdoCommand Invoke
AdoConnection Get
AdoDataProvider Get
AlternateDataStream Test
Apartment Invoke
Archive Expand, Read
Assembly Test
@turboBasic
turboBasic / Get-ModuleNounsAndVerbs.ps1
Last active December 2, 2017 00:51
[Get-ModuleNounsAndVerbs.ps1] gets all functions in module, arranged by noun #powershell #confirm
function Get-ModuleNounsAndVerbs {
<#
.SYNOPSIS
Gets list of cmdlet & function nouns in a module, each noun is complimented with the list of cmdlet verbs
.DESCRIPTION
Helps to understand internal logic of a module by summarizing its cmdlets by used nouns.
Cmdlet gets sorted list of unique cmdlet & function nouns in a module, and complement each one with the list of verbs implemented in a module
.INPUTS
@turboBasic
turboBasic / MyModule.psd1
Last active May 13, 2020 13:17
Get-DynamicModuleImportsExample in #powershell, considering ./private and ./public subfolders with individual .ps1 files. Source: @RamblingCookieMonster/PSStackExchange/blob/master/PSStackExchange/PSStackExchange.psm1
#
# Module manifest for module 'PSStackExchange'
#
# Generated by: RamblingCookieMonster
#
# Generated on: 8/2/2015
#
@{
@turboBasic
turboBasic / Get-PowershellCookBook.ps1
Last active September 8, 2017 12:08
[Disable some functions in Lee Holmes' Powershell Cookbook] so that not overwrite your existing functions. Run this, then open PowershellCookBook.psd1 and paste in `FunctionsToExport = ` line, then comment/delete functions you are not going to export. #powershell
New-Item -type Directory .\Module_PowershellCookBook
Save-Module -name PowerShellCookbook -path .\Module_PowershellCookBook
& {
$fileName = Get-ChildItem -path .\Module_PowershellCookBook\*\PowerShellCookbook.psm1 -recurse
$functions = Get-Content -path $fileName.fullName |
%{ Select-String '(?ix) ^(?<= \s*) function \s* ([-\w]+) \s* $' -input $_ -allMatches } |
%{ $_.Matches.Groups[1].Value }
($functions | %{ "'$_'" }) -join ",`n" | Out-Clipboard
}
@turboBasic
turboBasic / Get-DataSectionExamples.ps1
Last active September 9, 2017 00:16
[Get-DataSectionExamples] in Powershell - short summary #powershell
DATA msgs { ConvertFrom-StringData @'
Err01 = Attention!
Err02 = File not found!
'@
}
DATA exportVariables {
'variableName1'
'variableName2'
}
@turboBasic
turboBasic / Fx3-Places-ERD.png
Last active September 10, 2017 19:28
[Get-FirefoxPlacesDB] Schema of Places database of Mozilla #firefox
Fx3-Places-ERD.png
@turboBasic
turboBasic / Get-ChocolateySearchExamples.md
Last active September 11, 2017 08:55
[Get-ChocolateySearchExamples] as chocolatey has paticularly weird default search behaviour #chocolatey

choco list jq

jq 1.5 [Approved] Downloads cached for licensed users
EthanBrown.SublimeText2.WebPackages 0.3.0 - Possibly broken
velocity 1.1.8 [Approved] Downloads cached for licensed users
Dable 1.2.1 [Approved]
4 packages found.
@turboBasic
turboBasic / New-ADKenvironment.ps1
Last active October 9, 2017 12:57
[Windows ADK Environment] Creates environment for Windows 10 ADK #powershell #windows #deployment
Function New-WindowsSetupISO {
Param(
[Parameter(
Mandatory = $false
)]
[alias( 'sourcePath' )]
[string] $Path = '.',
[Parameter(
Mandatory,
@turboBasic
turboBasic / Get-ComplexInvokeExample.ps1
Last active May 13, 2020 13:16
Invoke complex commands from #powershell
$PathToOscdimg = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\"
$BootData = '2#p0,e,b"{0}"#pEF,e,b"{1}"' -f "$ISOMediaFolder\boot\etfsboot.com", "$ISOMediaFolder\efi\Microsoft\boot\efisys.bin"
$Arguments = @{
FilePath = "$PathToOscdimg\oscdimg.exe"
ArgumentList = @(
"-bootdata:$BootData",
'-u2',
'-udfver102',
"$ISOMediaFolder",
"$ISOFile"
@turboBasic
turboBasic / Add-SendToStartMenuDestination.cmd
Last active October 12, 2017 14:47
[Allow access to "~\Start Menu" and "~\SendTo" junctions] (elevated) #cmd
mklink /d %userProfile%\SendTo\SendTo %userProfile%\SendTo
mklink /d %userProfile%\SendTo\StartMenu_Programs "%userProfile%\Start Menu\Programs"
mklink /d %userProfile%\SendTo\StartMenu_Programs_AllUsers "%allUsersProfile%\Start Menu\Programs"
pushd %userProfile%\SendTo
attrib +h "Mail Recipient.MAPIMail"
attrib +h Documents.mydocs
attrib +h "Bluetooth File Transfer.LNK"
attrib +h "Compressed (zipped) Folder.ZFSendToTarget"
popd