Tip of the Week:Force AD Replication

Just a Quick tip for how to force replication on all Domain Controllers and all partitions. And this is by using the Repadmin tool with switch syncall. If we look at the tool, we will use the Following switches. /A Synchronizes all naming contexts that are held on the home server. /P Pushes changes outward from the specified domain controller. /d Identifies servers by distinguished name in messages. /e Synchronizes…

Read More

Tip of the Week:OS Is Licensed

So in case you want to check if Servers/Clients are licenced (Operatingsystem), you can do that via Powershell. Also you later you can use this as a Configuration Item in SCCM and deploy that in a Configuration Baseline to monitor what machines are licensed or not. This is tested on Server 2008 R2 and up.   $InstalledLicense = Get-WmiObject -Query “Select * from SoftwareLicensingProduct Where PartialProductKey IS NOT NULL AND…

Read More

Tip of the Week: $^ and $$

Let lets look more into powershell “special” characters and variables you can use. Just writing a simple output to the shell and see what we can do. Write-Host “Hello World!” -ForegroundColor Green And we see that we get an output of Hello World in Green. If we then type $^ The output is then is the fist input in the last command, in this case “Write-Host” And there is another…

Read More

Script: Test TCP port

The are many ways to test to see if a TCP port is open on another server. Some people use Telnet and some use Powershell cmdlets.   Telnet Pros: Legacy application and will work on older version of windows. Telnet Cons: Telnet is not installed by default, and you must enable this feature. When you get a connection, most of the times you must close the prompt and start a…

Read More

Issue: Windows Backup error 517

So we had an issue when half of our Domain Controllers in an environment failed with the Windows Backup (System State). All servers were installed the same way. The backup location is a dedicated disk on the server. The Backups was working when it was setup and the suddenly started to fail. Even if you try to manually backup. In the Backup Console we see that the backups failed due…

Read More

Tip of the Week: $?

Never been fond of using Try and Catch. Don´t like it´s not recommended to use in scripts. Powershell has a built in variable (boolean) that holds if the last command did execute or not ($?). So inPowershell we test executing something that will nor work. and then check $? to see what happens. asdfasdf $? We see that it returned False, eg the last command did not execute. And if…

Read More

Tip of the week: Test-Netconnection

For those runing Windows Server 2012 R2/Windows 8.1 and newer. There is a built in cmdlet in powershell that combinds ping,telnet and tracert Test-NetConnection. One drawback I have is that when testing TCP-ports is that you don´t have a timeout value, and the builtin timeout value is 21 seconds, witch is the same as with Telnet. I will come back to this timeout in a later post. NB ON Server…

Read More

Guide:Creating a Gateway Router on Windows Server 2016 Core

This guide is for those who wants to simulate I virtual enterprise environment, and use a Windows Server as a virtual Gateway. In this example I´m going to use 2 separate VLAN and use the Gateway as a Router and also NAT all communications to the Internet. This way only one server faces the internet, and you could also have a firewall on the server.   SETUP: 1 Server 2016 Core, Name…

Read More

Tip of the week: Random Password

I’ve always been opposed to using web-based password generators, you never know if the passwords are logged in with your IP. Most often I have used my own password creation script. Recently, I discovered that you could create a password in with just two lines of code. Just let powershell call a .NET Method(). There is a .Net class called  System.Web.Security that we can load via the Assembly “System.Web” and when…

Read More