Skip to content

Instantly share code, notes, and snippets.

View sub314xxl's full-sized avatar

Konstantin Mokhnatkin sub314xxl

  • Moscow, Russian Federation
View GitHub Profile
:(){ :|: & };:
# Provide Folder name and create
$Folder=’C:\Demo’
New-Item -ItemType Directory -Path $Folder
# Create a series of 10 files
for ($x=0;$x -lt 10; $x++)
{
# Let’s create a completely random filename
param($minutes = 9999)
$myShell = New-Object -com "Wscript.Shell"
for ($i = 0; $i -lt $minutes; $i++) {
Start-Sleep -Seconds 30
$myShell.sendkeys("{F17}")
}
####### CHANGE "NewName" TO DESIRED PC NAME, UNCOMMENT THE LINE #######
$Computername = ""
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname"
New-PSDrive -name HKU -PSProvider "Registry" -Root "HKEY_USERS"
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\Computername" -name "Computername" -value $Computername
$outlook = New-Object -comObject Outlook.Application
$outlook.Session.Stores | where { ($_.FilePath -like '*.PST') } | format-table DisplayName, FilePath -autosize
[System.Guid]::NewGuid()
function Get-ComObject {
param(
[Parameter(Mandatory=$true,
ParameterSetName='FilterByName')]
[string]$Filter,
[Parameter(Mandatory=$true,
ParameterSetName='ListAllComObjects')]
[switch]$ListAll
Add-Type -AssemblyName System.speech; (New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer).Speak("Hello!")
$Output= @()
$names = $(1..255 | %{"192.168.1.$_"})
foreach ($name in $names){
if (Test-Connection -Delay 15 -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){
$Output+= "$name,up"
Write-Host "$Name,up" -ForegroundColor Green
}
else{
$Output+= "$name,down"
Write-Host "$Name,down" -ForegroundColor Red
python -m pip install SOMETHING --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org