Posts

Showing posts from September, 2017

Stop Antimalware Service Executable - Turn Off Windows Defender

Image
If you're using a Windows machine in a test environment and you're not interested in the protection that Windows Defender offers, you can turn off Windows Defender and prevent the Antimalware Service Executable from taking CPU resources away from other processes. To do this, open the relevant policy editor then navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Defender > Turn off Windows  Defender Once the policy is applied to a machine, Windows Defender will be turned off.

PowerShell check if firewall rule exists before create

This post describes how to use PowerShell to check if a firewall rule exists in Windows. This can be very useful if you're creating a PowerShell script which creates Windows Firewall rules multiple times and you don't want to end up adding lots of duplicate firewall rules! Command Using the netsh command, you can check for the existence of rules e.g. with a particular name: netsh advfirewall firewall show rule name="** TCP Port 1433" This returns "No rules match the specified criteria." if no rules are found. Solution Put the netsh command in an if statement to check if the rule exists before creating it: if (( netsh   advfirewall   firewall   show   rule   name="** TCP Port 1433" )  -Contains   "No rules match the specified criteria." ) {   netsh advfirewall firewall add rule name="** TCP Port 1433" dir=in protocol=TCP localport=1433 action=allow } Edit: This script was corrected following the co

Windows Server 2016 start menu search not working

Image
If you're using the Windows Server 2016 start menu and the search is not working, even though you know for sure that what you're searching for exists in the start menu, this post describes a few techniques to resolve this issue. Windows Search Service Firstly, you need to install the 'Windows Search Service' feature: Windows Server 2016 Unlike Windows Server 2012 R2 in which the 'Windows Search' service is already started, on Windows Server 2016, you have to change the startup type to Automatic and Start the service. Once the indexing is complete, you should then be able to find shortcuts in your Windows Server 2016 start menu. Administrator If you're logged in as Administrator, you may also need to enable UAC Admin Approval mode: Start > Run > secpol.msc > Local Policies > Security Options > User Account Control: Admin Approval Mode for the Built-in Administrator account Then restart the machine. Video YouTub

Fix Slow Search in Start Menu on Windows Server 2012 R2

Image
If you're experiencing a slow search in the start menu on Windows Server 2012 R2 then this post describes a quick and easy way to fix this issue. All you need to do is install the feature 'Windows Search Service': Windows will then index the Start Menu and Users locations.  You can see how many items have been indexed by opening the Indexing Options: Once this is complete, you should notice that searching the start menu on Windows Server 2012 R2 is a lot faster.

Get Started with XIA Configuration Server v9.1

Image
If you've recently installed XIA Configuration Server v9.1 and you need some help getting started, take a look at this video from CENTREL Solutions: The video describes how to perform your first scan using the XIA Configuration Client and how to perform some of the main functions, such as generating documentation, from the XIA Configuration Server web interface. Find out more about XIA Configuration > Request a Free Trial >

The trust relationship between this workstation and the primary domain failed VMware snapshot

Image
This article describes a really quick way to fix the error "The trust relationship between this workstation and the primary domain failed" on a VMware virtual machine snapshot.  A permanent fix is also included at the end of the article. Cause For me, this error occurs all the time when I revert to snapshots of my virtual machines within VMware Workstation.  In fact, I already blogged about how to fix this issue on Nano Server here:  http://howardsimpson.blogspot.co.uk/2017/09/fix-microsoft-nano-server-wont-logon-to-domain.html The error actually describes the problem quite well.  The domain member and domain controller have a trust in the form of cryptographic data.  As you change snapshot, the domain member's data no longer matches the domain controller. Fix Shut Down If your snapshot is shut down, the error will surface on the login screen when you boot the VM There are two ways to fix this: Fix 1 Firstly, you can log in as a local account...

Add Unicode Encoding Preamble Byte Order Mark (BOM) in C#

The Byte Order Mark (BOM) is a unicode character situated at the start of a text stream which indicates the byte order and unicode encoding the stream is encoded as. The following code shows one way to add this in C#: Encoding unicode = new UnicodeEncoding(); byte[] bom = unicode.GetPreamble(); byte[] encodedBytes = unicode.GetBytes("Text I want to encode"); byte[] combinedBytes = new byte[bom.Length + encodedBytes.Length]; System.Buffer.BlockCopy(bom, 0, combinedBytes, 0, bom.Length); System.Buffer.BlockCopy(encodedBytes, 0, combinedBytes, bom.Length, encodedBytes.Length); The preamble is obtained from the UnicodeEncoding object using the GetPreamble method.  The encoded byte array is then concatenated with the preamble using System.Buffer.BlockCopy. You can then write the byte array out to a file and the byte order mark will be included at the start.

Microsoft Nano Server won't logon to domain

Image
This blog post describes the solution I used when I was not able to log onto a domain with Microsoft Nano Server even though I supplied correct credentials and I had previously successfully logged on to the domain with that server.  The error is "The user name, domain or password is incorrect.". The cause of this issue is likely because I'm using virtual machines with snapshots and, even though I'm rolling back to a snapshot after it has been added to the domain, the trust relationship between it and the domain fails , and it has to be added to the domain again. On a normal Windows server, this is straightforward as you can change the system property settings and add the server to the domain again. On Nano Server, to rejoin the domain, you first need to run this command on any domain controller: Djoin.exe /provision /domain <FQDN Of domain> /machine <DNS name of nano server> /savefile c:\<File Name> /reuse You then need to copy the doma