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 / New-Gen2VM.ps1
Last active October 14, 2017 15:38
[Create Gen.2 Hyper-V Virtual Machine]
New-VM -name WADK -memoryStartupBytes 750MB -generation 2 -newVHDPath b:\VMs\wadk.vhdx -newVHDSizeBytes 25GB -bootDevice VHD
Add-VMDvdDrive WADK
Start-Sleep -seconds 5
$ws2016ISO = "D:\ISOs\Windows Server 2016\Microsoft Windows Server 2016 Version 1607 Build 10.0.14393.447 Updated Jan 2017 VLSC\SW_DVD9_Win_Svr_STD_Core_and_DataCtr_Core_2016_64Bit_English_-3_MLF_X21-30350.ISO"
Set-VMDvdDrive -VMName WADK -path $ws2016ISO -toControllerNumber 0 -toControllerLocation 1
Start-Sleep -Seconds 5
@turboBasic
turboBasic / Get-AllWims.ps1
Last active October 14, 2017 23:27
[Collection of WIMs]
"w:\ISOs\windows10\1803\17004\install.wim",
"w:\ISOs\windows10\1703\release\install.wim",
"w:\ISOs\windowsServer2016\WinSrv2016StdUpdate2017Sep.iso" | %{
imagex /apply $_ 1
@turboBasic
turboBasic / Install-ChocoAndScoop.ps1
Last active April 14, 2022 13:09
Install Chocolatey and Scoop package managers for Windows + basic set of utilities and software
Function Install-Scoop {
New-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" `
-propertyType ExpandString `
-name "SCOOP_GLOBAL" `
-value "${ENV:PROGRAMDATA}\scoop"
Invoke-WebRequest 'https://get.scoop.sh' | Invoke-Expression
'scoop install Git-with-OpenSSH Sudo Which --global' | Set-Content -path temp_script.ps1
@turboBasic
turboBasic / Get-dotNetTimeZoneNames.ps1
Last active November 6, 2017 10:49
The list of .Net time zones with offset to UTC
# result: https://runkit.io/turbobasic/dotnettimezones/branches/master
[System.TimeZoneInfo]::GetSystemTimeZones() |
Select -property Id, @{ Name = 'BaseUtcOffsetHours'; Expression = {$_.BaseUtcOffset.TotalMinutes / 60} }
@turboBasic
turboBasic / Get-LatestUpdate.ps1
Last active March 15, 2018 20:44 — forked from keithga/Get-LatestUpdate.ps1
script to get latest Cumulative update for various builds of Windows 10 and Windows Server 2016
<#
.SYNOPSIS
Get the latest Cumulative update for Windows
.DESCRIPTION
This script will return the list of Cumulative updates for Windows 10 and Windows Server 2016 from the Microsoft Update Catalog.
.NOTES
Copyright Keith Garner ([email protected]), All rights reserved.
@turboBasic
turboBasic / Find-Path.ps1
Created December 20, 2017 17:12
Find-Path.ps1 returns paths of all existing filesystem items provided in form of glob, PathInfo or FileInfo objects. #powershell
function Find-Path {
<#
.EXAMPLE
Find-Path -path @('hgjf', '.', $null)
.EXAMPLE
Get-ChildItem . -recurse -filter *.ps1 | Find-Path
.EXAMPLE
'**/*.txt', (Get-ChildItem . -recurse) | Find-Path -ExcludeDirectory
@turboBasic
turboBasic / Find-FunctionSimple.ps1
Created December 20, 2017 17:16
Returns names of all functions declared in Powershell file, excluding all nested functions
function Find-FunctionSimple {
Param(
[Parameter( Mandatory )]
[AllowEmptyString()]
[String]
$Text
)
@turboBasic
turboBasic / Find-Function.ps1
Created December 20, 2017 17:17
Returns names of all Powershell functions declared in file paths
function Find-Function {
[CmdletBinding()]
Param(
[Parameter( Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName )]
[Object[]]
[Alias( 'FullName' )]
$Path
)
@turboBasic
turboBasic / Get-GistFiles.ps1
Last active December 23, 2017 06:46
[Get-GistFiles.ps1] Gets list of files inside the GitHub gists of a user. #powershell #github
#Requires -Version 3
#Requires -Modules Posh-Gist
function Get-GistFiles {
<#
.SYNOPSIS
Gets list of files inside the GitHub gists of a user
.DESCRIPTION
Gets list of files inside the GitHub gists of a user. GitHub API is not very convenient
@turboBasic
turboBasic / New-AdhocModule.ps1
Last active December 23, 2017 07:46
[New-AdhocModule.ps1] Creating Module based on all .ps1 files in specified directories. No manifest required, one command and whole bunch of functions are encapsulated into module #powershell
function New-AdhocModule {
#
# .SYNOPSIS
# Creating Module based on all .ps1 files in specified directories
#
# .EXAMPLE
# New-AdhocModule -Path c:\ProgramData\Chocolatey\helpers\functions -Module ChocoTools
#
[CmdletBinding(