This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $folder = "C:\folder" | |
| $cmd = "powershell.exe " | |
| $args = "-NoLogo -NonInteractive -WindowStyle Maximized -File script.ps1" | |
| $user = "username-to-run-as" | |
| $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).Date -RepetitionInterval (New-TimeSpan -Minutes 1) | |
| $action = New-ScheduledTaskAction -WorkingDirectory $folder -Execute $cmd -Argument $args | |
| $settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew -RestartInterval (New-TimeSpan -Minutes 1) -RestartCount 999 -ExecutionTimeLimit (New-TimeSpan -Seconds 0) | |
| $principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive | |
| $task = New-ScheduledTask -Principal $principal -Action $action -Settings $settings -Trigger $trigger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # configure | |
| $cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName $env:COMPUTERNAME | |
| Enable-PSRemoting -SkipNetworkProfileCheck -Force | |
| New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $cert.Thumbprint –Force | |
| New-NetFirewallRule -DisplayName "Windows Remote Management (HTTPS-In)" -Name "Windows Remote Management (HTTPS-In)" -Profile Any -LocalPort 5986 -Protocol TCP | |
| # connect | |
| Enter-PSSession -ComputerName {X.X.X.X} -Credential (Get-Credential) -SessionOption (New-PsSessionOption -SkipCACheck -SkipCNCheck) -UseSSL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0", | |
| "parameters": { | |
| "vnet": { | |
| "type": "string", | |
| "defaultValue": "resource-group/vnet-name" | |
| }, | |
| "ipAddress": { | |
| "type": "string", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0", | |
| "parameters": { | |
| "sku": { | |
| "type": "string", | |
| "defaultValue": "B1" | |
| } | |
| }, | |
| "variables": { |