virtualcenter


Our IT journal

Use PowerShell to post to a Slack channel with extra args

You need to create an application in Slack with incoming webhooks. Enable the application and confirm your identity. Copy that webhook. Invoke the script with system variables to post extra content for alerts, automation, escalations, etc. $message = “`n” + $args Set-StrictMode -Version Latest $payload = @{ “channel” = “#alerts”; “icon_emoji” = “:inbox_tray:”; “text” = $(Write-output “$message”); “username” = “User”; … Read More


Keep-alive script for Windows VPN connections

$ServerName = “192.168.40.1” ##### Script Starts Here ###### foreach ($Server in $ServerName) { if (test-Connection -ComputerName $Server -Count 2 -Quiet ) { write-Host “$Server is alive and Pinging ” -ForegroundColor Green } else { Write-Host “$Server is down.” Write-Host “Disconnecting…” rasdial.exe “Woodside” /DISCONNECT Write-Host “Connecting…” rasdial.exe “Woodside” user vpnpassword } }  


Changing an IP on a backup object in Altaro Backup

On a client we changed the IP addressing on their network and we already had backups in place from Altaro. Altaro didn’t take DNS changes as the vcenter was hardcoded with its IP address. In order to keep the existing chains we needed to change the VMware vCenter IP. In order to change this, we had to download SQL lite browser. … Read More


L2TP IPSec VPN fails on Windows – Enable UDP encapsulation

Open up regedit and go to the following location HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent Create a DWORD32 entry, name it AssumeUDPEncapsulationContextOnSendRule and enter a value of 2. Save and Reboot.   You can optionally execute this command on an elevated prompt. Also reboot to apply. REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d 0x2 /f


Clean up records on Windows Server DNS using PowerShell

Create a script and execute it on your server. Set up a zone, the Windows Server running the DNS server, a date and the record type. Import-mode DNSServer $zone=”ZONE.TLD” $DNSServer=”DNSHOSTNAME” $beforedate=”12/20/2015″ $recordtype=”A” $records=Get-DnsServerResourceRecord -ZoneName “$zone” -ComputerName $DNSServer | Where-Object {$_.RecordType -eq “$recordtype” -and $_.TimeStamp -lt $beforedate} Foreach ($record in $records) { # Remove the DNS record by filtering Try { … Read More


Enable RDP on RDWeb when publishing applications

Sometimes we publish applications on the web front end, but we also want to give clients the option on launching an RDP session directly from the website. For doing that we need to change a registry and reboot the server: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\<collection>\RemoteDesktops\<collection> Change ShowInPortal from “0” to “1”.  


Set up a dedicated SSL certificate for a RDS Host

Start by installing the certificate on the Local Machine Personal folder. Do an export to a PFX file including the private key. Access the certificate and retrieve its thumbprint from its properties. Download the following script and save it in the destination server. Use your thumbprint to enable the new certificate  


Configuring VPN profiles via CMAK

Sometimes we have to roll out our VPN, and manually creating a profile or asking a user to execute a Powershell script it’s not something we do every day. Instead, Microsoft gave us CMAK – or Connection Manager Administrator Kit, a Windows Feature that can be installed on your Windows Workstation or Server via Windows Features:   Launch cmak, and … Read More


FQDN access RDWeb by default on Windows Remote Desktop Services

We want our default FQDN to go directly to the RD Web Access webpage. This also helps to remember just the domain name and no extra paths. In order to do a redirect, go to your IIS and put a redirect on your Default Web Site:   This will also redirect all HTTP traffic to HTTPS.  


Upgrading Windows Server 2012 2016 Evaluation to fully licensed

You can’t apply a license on top of a 2012/2016 Evaluation as is – you will receive a “Server 2016 Edition cannot be upgraded” message when putting the new key. List current edition dism /online /Get-CurrentEdition In order to apply the key for Standard, you will need to run this DISM command: dism /online /set-edition:ServerStandard /productkey:<yourkey> /accepteula For Datacenter: dism … Read More