Skip to content

Instantly share code, notes, and snippets.

$Host.ui.RawUI.WindowTitle = 'Keep Alive!'
$WShell = New-Object -com "Wscript.Shell"
Clear-Host
while ($true)
{
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Milliseconds 100
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Seconds 120
}
#Enum UpdatesResultCode{ NotStarted; InProgress; Succeeded; SucceededWithErrors; Failed; Aborted }
$UpdatesResultCode = @{0 = 'NotStarted';1 = 'InProgress';2 = 'Succeeded';3 = 'SucceededWithErrors';4 = 'Failed';5 = 'Aborted'}
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$UpdateServiceManager = New-Object -ComObject Microsoft.Update.ServiceManager
$Searcher.ServiceID = $UpdateServiceManager.Services | ? Name -eq 'Windows Update' | Select-Object -ExpandProperty ServiceID
Write-Verbose -Verbose -Message 'Collecting data about missing updates from "Windows Update" service'
$Result = $Searcher.Search('IsAssigned=1 and IsHidden=0 and IsInstalled=0')
$ParamNewScheduledTaskAction = @{
Execute = 'Powershell.exe'
Argument = '-NoProfile -WindowStyle Hidden -File "C:\Dns.ps1"'
}
$action = New-ScheduledTaskAction @ParamNewScheduledTaskAction
$trigger = New-ScheduledTaskTrigger -Daily -At 12pm
$ParamRegisterScheduledTask = @{
Action = $action
Trigger = $trigger
TaskName = 'Remove Dns records (30 day plus)'
if ($foundService) {
Write-host "Executing $operation service '$serviceName' on remote machine '$ip'"
# execute the operation service
if($operation -eq "start") { # start
$foundService | Start-Service
} elseif($operation -eq "stop") { # stop
$foundService| Stop-Service
} else { # restart
$foundService | Stop-Service -NoWait
# https://overpoweredshell.com/Creating-A-DSC-Class-Based-Resource/
[DscResource()]
class DriveLabel
{
[DscProperty(Key)]
[string]
$DriveLetter
[DscProperty(Mandatory)]
[string]
$Rows = Import-Csv -Path .\NewVMs.csv
#$Rows = @( [PsCustomObject]@{VMName = 'Training01'; Owner = 'It Infra'} )
$ErrorActionPreference = 'stop'
Import-Module -Name Az.Accounts, Az.Compute, Az.Network, Az.Resources
Connect-AzAccount -SubscriptionId 3a223927-ac2f-49a8-a134-0f4759d2e5cb
# Azure VM specs
$RG = @{
Location = "southeastasia"
Function Connect-Zabbix {
[CmdLetBinding()]
Param
(
[Parameter(Mandatory, Position = 0)]
[String]$Uri,
[Parameter(Mandatory, Position = 1)]
[String]$Token
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER
parted /dev/sdb # if you restarted server or line below first to rescan iSCSI first
echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan # rescan devices after vmware disk resize
parted /dev/sdb # go for parted now!
- print # to check
- resizepart # Command to do resize
- 1 # Partition number
- Yes # for question if we want to check
- 100% # resize to max value
- print # check if magicx was done
- quit # be done with it
Zaklad:
Ingredience:
- 3 vejce + 50-70g trtinoveho cukru a uslehat
- 180g polohrube mouky
- 1/2 prasku do peciva
- 5g jedle sody (nemusi ale lip to naskakuje)
- 100g masla <<<<<------- ;) mozna 50/50 nebo 25/75 ;)
- 110g mleka
- 1 lzicka kakaa - podle barevne potreby ja ji vynechavam pro cheesecake ale do muffinu se hodi
HowTo: |