Aug 31

Remove RDS CALs from RDS Server

Background

There are many circumstances where you will need to remove a RDS CALs from an RDS Server, or in some cases you want to rebuild the entire RD licensing database.  Microsoft allows you to remove an individual CAL license pack using powershell, or rebuild the entire database.  However, if neither of those work, it’s quite easy to manually rebuild the RD licensing database.  I’ve included directions for all 3 methods below, and have tested this on Windows Server 2008, 2008R2, 2012, 2012R2, and 2016.

Remove An Individual RDS CAL License Pack Using Powershell (User or Device CAL)

  • Open powershell elevated as an administrator
  • Type the following command to list the RDS Licenses and note the KeyPackID
    • Alternatively, open RD Licensing Manager and note the Keypack ID

  • Run the below command to remove the licenses pack from your RD Server
    • Replace KEYPACKID with the number you obtained above

 

Rebuild the RD Licensing Database

Microsoft provides directions on how to do this automatically, via a web browser, or via the phone:

https://technet.microsoft.com/en-us/library/dd851428.aspx

 

Manually Rebuild the Licensing Database (Guaranteed to Work if the Previous 2 methods Fail)

  • Make sure you have documentation of your MS License agreement that includes Authorization number, License number, License type (User/Device CAL), and Quantity before proceeding
  • Stop the Remote Desktop Licensing service

Stop Remote Desktop Licensing Service

  • Rename C:\Windows\System32\lserver\TLSLic.edb to C:\Windows\System32\lserver\TLSLic.old
  • Start the Remote Desktop Licensing service
  • All licenses will now be cleared out of RD Licensing Manager, and you’ll need to re-install the licenses you want to add back in
Oct 28

Missing Power and Search Button On Start Screen

Missing Power and Search Button On Start Screen on Server 2012 R2 and Windows 8.1

Recently, after installing a Windows 2012 R2 Server VM, I noticed the Start screen was missing the Power and Search buttons.  All of my older Server 2012 R2 Server VM’s had the Power and Search button on the start screen, I used the same ISO to install, and Windows was 100% up to date.  After researching, this issue can affect Windows Server 2012 R2 as well as Windows 8.1.  Here is a screenshot of my Start screen missing both the Power and Search buttons:

Power and Search Button Missing On Start Screen

The Solution

The short answer is KB2919355 needs installed.  HOWEVER, you need to make sure you install the following updates in this order:

  1. Prerequisite: KB2919442
  2. Install KB2919355 that has multiple downloads in it, which can be directly downloaded from the Microsoft Download Center
    1. Windows 8.1 x86
    2. Windows 8.1 x64
    3. Server 2012 R2 x64
    4. NOTE: Once downloaded, these updates need installed in the following order
      1. clearcompressionflag.exe
      2. KB2919355 (Reboot after installation, if fixed you can skip the rest)
      3. KB2932046
      4. KB2959977
      5. KB2937592
      6. KB2938439
      7. KB2934018

Once KB2919355 is installed and you reboot, you should now see the Power and Search buttons on the start screen as displayed below:

Power and Search Button On Start Screen

Final Notes

Once KB2919355 is installed, run Windows Updates and you’ll probably need to install a few hundred updates again

 

 

Sep 22

Move Off-Screen Window in Windows

Have you ever had a window that ended up off of your screen and were unable to move it back into view?  I’ve personally had this occur after disconnecting a monitor from my laptop which I had my desktop extended on.  However, there’s a simple trick to move the Window back into view of your desktop.

Make the Off-Screen Window Active

  • Hold the Alt key down and then press Tab key until you’ve selected the Window that is off-screen

tab_selector

Select Move for the Active Window

  • Hold the Alt key down, press the Space-bar key, then press the M key

Move Your Window Back Into View

  • You can now move the window in the desired direction with the arrow keys
Jul 14

Complex Password Generator

 

Jul 14

365 Password Generator

This powershell script bulk generates passwords in a similar style as the password generator in Office 365.  The passwords begin with a capital letter, followed by 5 lower case letters, and 2 digits at the end.  You can modify the pattern to suite your needs (Note: It’s using the ASCII table ranges as the set it randomly chooses from).

 

Mar 03

Determine If Distribution Group is Being Used in 365 Exchange

“What distribution groups are in use?” and “How many emails are sent to a specific distribution group per month?” are common questions I receive with 365 Exchange or Exchange.  Unfortunately, there is nothing built in that tracks how many emails on sent to a distribution group.  However we can use Get-MessageTrace to count the number of messages sent to a distribution group for a time range with the max being 30 days.  Also note, the by default PageSize returns 1000 items but you can increase the PageSize to 5000 items.  For example, to get the number of emails sent to the distribution group everyone@domain.com for a single day we can use:

Using this method, we can count the number of emails sent to each distribution group each day and store the results in an output file.  We can then query those output files and create a report.  In my example, the report will show the total emails sent to each distribution group by month and go back 12 months.  Now without further ado, let’s get to the two scripts needed.

365_DGCounter.ps1

Note: [DateTime]::Today returns 12:00 AM of the Current Date.  Let’s assume the date is currently 3/3/2016.  The script above would return the range 3/2/2016 12:00 AM to 3/3/2016 12:00 AM.  Running this script will actually return the email counts from yesterday since today has not ended.

365_DGCounterReport.ps1

 

Oct 27

List All DNS Records with Powershell

UPDATED 6/16/2016 Thanks for the comments!

Here’s a nice quick script to list all DNS records in each zone on the DNS server(includes sub-zones):

From the DNS Server

From a Remote DNS Server

From a Remote DNS Server (Output to Tab Delimited File)

 

Jul 08

vi Cheatsheet

OVERVIEW

Almost every Linux distribution includes the vi text editor, and it’s usually the only text editor included in minimal installations.  If you’ve never used vi, it can seem really confusing at first and can even be frustrating since you’ll need to use it to configure network settings prior to downloading another text editor such as nano.  If you’re not familiar with vi, it is important to note there is a “command” and “insert” mode. If you’ve never used vi, you’ll probably find it easier at first to enter “insert” mode when modifying a text file, escaping to command mode, and entering the command to save and quit.  Here’s a quick cheat sheet of the commands you’ll need:

Command Definition
i Enters “insert” mode
esc The escape key exits “insert” mode and returns to “command” mode
:wq In command mode this saves the file and quits once you press the enter key
:q! In command mode this quits the file without saving once you press the enter key

EXAMPLE

Open a file to edit with vi

Once you open the file, you’ll be in command mode by default and you’ll see the line count and character count at the bottom of the file

vi_opened

Now, if you press the ” i “ key you’ll now enter insert mode which is noted at the bottom.  Once in insert mode, you can edit text where the blinking cursor is located just like most other text editors.

vi_insert_mode

Once you’ve finished your modifications, press the Esc key to return to command mode.  In command mode, you’ll see your commands appear at the bottom of the screen when you type them.  Save and quite by pressing the colon key, w key, q key, and press the Enter to execute the commands.

vi_save_quit

Once complete, you’ll see a notification that the file was written.

vi_written

Jul 08

How to Configure Network Settings in CentOS 7

1 – FIND YOUR NETWORK ADAPTER

Once logged in, you’ll want to enable and configure your network adapter.  First, you’ll need to get the name of your network adapter(s) by running the following command:

Below you’ll see my results of running this command.  My results show I have an Ethernet adaptor called ens160 and it’s currently disabled.  Please take note of the name of your network adapter, which may be different.

"nmcli d" Results

2 – CONFIGURE NETWORK ADAPTOR

Once you have the name of your network adapter, you’ll want to enable it and configure it.  We will configure it using the vi text editor.  If you’re not familiar with vi, take a look at:

vi cheat sheet

Use the following command to use vi to configure your network settings.  Note: replace ens160 with the name of your network adapter you noted above)

The content will look something like this:

To Configure a DHCP IP

Modify the following lines:

To Configure a Static IP

Modify the following line:

Add the following lines and replace them with the static IP settings you need.  Note: DOMAIN is the default DNS Search domain and it’s optional to add that line.

3 – CONFIGURE HOST NAME (Optional)

Optionally, you can use vi to configure the host name and default search domain by running:

Modify the following line:

4 – RESTART NETWORK SERVICE

To apply your new network settings run the following command to restart the network service

 

Jul 08

How to Install CentOS 7 Minimal

1 – INSTALL OPERATING SYSTEM

Select Install CentOS 7 and press Enter

Install CentOS 7

Press Enter to begin the installation

Press the Enter Key to begin the installation process

Select your Language and click Continue

CentOS7_Language

Complete any items marked with the Exclamation icon.  Only the Installation Destination should be marked and will be automatic partitioning by default.  Click Installation Destination

CentOS7_Installation_Summary

By default automatic partitioning is selected.  Review the automatic partitioning and confirm it suits your needs and click Done.  Otherwise, you’ll need to manually complete the partitioning (beyond this tutorial).CentOS7_Installation_Destination

Once all the items marked with the exclamation icon are complete, click Begin InstallationCentOS7_Begin_Installation

CentOS 7 will now begin to install.  Click Root Password to set the password while you wait for the installation to finish.

CentOS7_Root_Password_Is_Not_Set

Enter your Root password twice and click Done.  CentOS will rate the strength of your password and obviously the stronger the better.

CentOS7_Root_Password

Once the installation completes, click Reboot.

CentOS7_Complete

The boot menu will automatically boot CentOS 7

CentOS7_Boot_Menu

2 – LOGIN AS ROOT

Once the OS boots, login using username root and the password you set during the installation.CentOS7_Login

3 – CONFIGURE NETWORK ADAPTER

How to Configure Network Settings in CentOS 7

4 – INSTALL VMWARE TOOLS (Optional)

If this installation of CentOS 7 is a VMWare Guest OS, you may wish to install the VMWare Tools by running the following command:

5 – INSTALL NANO (Optional)

If you are not a fan of the vi text editor, you may wish to install Nano which has a more natural text editor feel to it by running:

6 – INSTALL UPDATES

Install updates by running:

7 – CREATE A SUDOER USER

It’s best practice to not use the root (super-user) user account.  Instead, you should always use a regular user account and allow them root privileges by adding them to the sudoers file.  You can then run privileged commands by use the sudo or su commands.  Let’s first start by creating a user by running the following command (where sigkill is the username):

Next, we want to set the password for our user by running the following command and enter the password twice when prompted:

Here is an example of the output you’ll receive

Add User

Now that your user is created, you want to add them to the sudoers file.  You can edit the sudoers file with vi by running the following command.  (NOTE: If you’re not familiar with vi, take a look at vi cheat sheet)

Near the end of the sudoers file, locate the following lines

Add the following line directly below the above lines then save and quit (:wq)

Here is an example of how it should look

Sudoers File

8 – PREVENT REMOTE SSH ACCESS FOR ROOT

By default, SSH is installed and ready to work once you configure a network adapter.  Another best practice is to prevent remote SSH access to the root account.

Locate the following line

Modify the above line to the following then save and quit the file

Restart the SSH Service by running the following command