Skip to content

Instantly share code, notes, and snippets.

@machv
machv / firewall.ps1
Created February 15, 2014 14:07
Set Public networks profile to private
$NLMType = [Type]::GetTypeFromCLSID(‘DCB00C01-570F-4A9B-8D69-199FDBA5723B’)
$INetworkListManager = [Activator]::CreateInstance($NLMType)
$NLM_ENUM_NETWORK_CONNECTED = 1
$NLM_NETWORK_CATEGORY_PUBLIC = 0x00
$NLM_NETWORK_CATEGORY_PRIVATE = 0x01
$INetworks = $INetworkListManager.GetNetworks($NLM_ENUM_NETWORK_CONNECTED)
foreach ($INetwork in $INetworks)
@machv
machv / common.config
Last active August 29, 2015 14:14
Mediatel WallBoard
{
"LayoutType" : "PANEL",
"PanelRows" : "2",
"PanelCols" : "4",
"RowDataSQL" : "",
"FontSize" : "1.0",
"DBType" : "MICROSOFT",
"DBConnStr" : "data source=APSHODMS;initial catalog=MediatelAutodialer;persist security info=True;user id=mediatel;password=---",
"WebService" : "http://172.26.9.4:8888/RealTimeWS.asmx",
@machv
machv / int_to_string.php
Created September 11, 2015 09:00
int to string for CZ
<?php
function int_to_text($int, $x = 1)
{
$len = strlen($int);
// desítky + jednotky
if(($len - 2) >= 0)
$des = substr($int, $len - 2, 2); //dvojciferne
else $des = substr($int, $len - 1, 1); //jednociferne
if($des < 21)
$des_text = int_to_text_basic($des, $x);
declare @databasesToRestore table (BakFile nvarchar(128));
insert @databasesToRestore(BakFile) values
('S545.bak'),
('S1101546.bak');
---('S1101546.bak'),
---('S01601101547.bak');
---('S7.bak'),
---('S01549.bak'),
---('S.bak'),
@machv
machv / Get-WebCertificate.ps1
Created July 26, 2018 10:53
Generate WebServer certificate
function Get-WebCertificate {
Param(
[parameter(Mandatory = $true)]
[String]
$Fqdn,
[parameter(Mandatory = $true)]
[String]
$CertificateOutputPath,
@machv
machv / Bootstrap.ini
Created November 7, 2018 11:13
[MDT] Multi-site deployment
[Settings]
Priority=FallbackDeployRoot, DefaultGateway, Default
[FallbackDeployRoot]
; Default deployment root in case of failure in the next step with the gateway selection
DeployRoot=\\CZ-PRG-MDT\ClientDeploymentShare$
[DefaultGateway]
; Based on the default gateway we will select corresponding location section
172.24.39.254=CZ-PRAHA
@machv
machv / Test-Dns.ps1
Created April 8, 2019 07:48
Periodic DNS resolving test
function Test-DnsResolving($DnsServer, $Delay, $Query)
{
begin {
$testsCount = 0
$latencySum = 0
$max = [Double]0
$min = [Double]99999
[Console]::TreatControlCAsInput = $true
}
@machv
machv / Initialize-DockerSwarm.ps1
Last active April 25, 2019 07:53
Initialize Docker Swarm cluster in Windows
$hosts = 1..2 | foreach { ("swarm{0:00}.{1}" -f $_, $env:USERDNSDOMAIN).ToLower() }
# Install Docker Engine to all nodes
Invoke-Command -ComputerName $hosts -ScriptBlock {
Install-PackageProvider -name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
}
# Restart is needed
@machv
machv / Enable-TeamsLicense.ps1
Created June 26, 2019 16:28
Enable Teams for 365 users
Connect-AzureAD
$skus = Get-AzureADSubscribedSku
$skus | Select -Property Sku*,ConsumedUnits -ExpandProperty PrepaidUnits | Select SkuPartNumber, ConsumedUnits, Enabled
$sku = $skus | where SkuPartNumber -eq "O365_BUSINESS_ESSENTIALS"
$sku.ServicePlans
$serviceToEnable = "57ff2da0-773e-42df-b2af-ffb7a2317929"
$users = Get-AzureADUser
$user = $users | Select -First 1 -Skip 2
wmic path softwarelicensingservice get OA3xOriginalProductKey