Skip to content

Instantly share code, notes, and snippets.

View sub314xxl's full-sized avatar

Konstantin Mokhnatkin sub314xxl

  • Moscow, Russian Federation
View GitHub Profile
# minimum size of USB stick 5.29GB
# Set here the path of your ISO file
$iso = 'C:\Users\localuser\Downloads\en_windows_server_2016_x64_dvd_9327751.iso'
# Clean ! will clear any plugged-in USB stick!!
Get-Disk | Where BusType -eq 'USB' |
Clear-Disk -RemoveData -Confirm:$true -PassThru
# Convert GPT
Function
Convert-WindowsImage
{
<#
.NOTES
Copyright (c) Microsoft Corporation. All rights reserved.
Use of this sample source code is subject to the terms of the Microsoft
license agreement under which you licensed this sample source code. If
CN=Homo sapiens,OU=Homo,OU=Hominidae,OU=Catarrhini,OU=Haplorrhini,OU=Primates,OU=Euarchontoglires,OU=Eutheria,OU=Mammalia,OU=Euteleostomi,OU=Vertebrata,OU=Craniata,OU=Chordata,OU=Metazoa,DC=Eukaryota
function New-IsoFile
{
<#
.Synopsis
Creates a new .iso file
.Description
The New-IsoFile cmdlet creates a new .iso file containing content from chosen folders
.Example
New-IsoFile "c:\tools","c:Downloads\utils"
This command creates a .iso file in $env:temp folder (default location) that contains c:\tools and c:\downloads\utils folders. The folders themselves are included at the root of the .iso image.
function Invoke-TSPingSweep {
<#
.SYNOPSIS
Scan IP-Addresses, Ports and HostNames
.DESCRIPTION
Scan for IP-Addresses, HostNames and open Ports in your Network.
.PARAMETER StartAddress
StartAddress Range
<#
.SYNOPSIS
Faster version of Compare-Object for large data sets with a single value.
.DESCRIPTION
Uses hash tables to improve comparison performance for large data sets.
.PARAMETER ReferenceObject
Specifies an array of objects used as a reference for comparison.
.PARAMETER DifferenceObject
Specifies the objects that are compared to the reference objects.
.PARAMETER IncludeEqual
@echo off
REM Copy Admin profile data to destination folder, e.g. Default user (so that newly created users start with the Admin profile data which has been configured).
REM 15.10.2016
SET SRC=C:\Users\Admin\
SET DEST=D:\tmp\TestUser
SET WIN10_MENU_FILE=C:\IT\config\Win10Menu\Win10MenuDefaultLayoutModification.xml
SET COPY_CMD=ROBOCOPY /NFL /NDL /NJH /NJS /NC /NS /NP
REM SET COPY_CMD=ROBOCOPY
Dim ProgramShortcutPath
Dim objProgramShortcut
Dim objFile
Dim FileName
Dim objBaseName
Dim SystemRoot
objFile = objFSO.GetFile(ProgramPath)
objBaseName = objFSO.GetBaseName(objFile)
REM This should be run with command prompt as an adminstrator.
REM Disable the antivirus and Windows Defender.
REM After disabling those, rename the file extension from .txt to .cmd
REM Then run this script.
REM This does not fix all privacy issues, you will still need to turn off some.
REM First, block Windows from sending data about you to their servers.
echo ## BEGIN Windows 10 privacy settings ##>>%windir%\system32\drivers\etc\hosts
echo 127.0.0.1 vortex.data.microsoft.com>>%windir%\system32\drivers\etc\hosts
Function ChangeReg {
param ([string] $RegKey,
[string] $Value,
[string] $SvcName,
[Int] $CheckValue,
[Int] $SetData)
Write-Host "Checking if $SvcName is enabled" -ForegroundColor Green
if (!(Test-Path $RegKey)){
Write-Host "Registry Key for service $SvcName does not exist, creating it now" -ForegroundColor Yellow
New-Item -Path (Split-Path $RegKey) -Name (Split-Path $RegKey -Leaf)