Address

Get All DCs in the Entire Forest

Getting a know a new environment for a new client and I a quickly needed information about all domain controllers in the entire forest.

Wrote a small little script to provide me all the information I needed:

 

Convert a Dynamic IP to Static

Working on a project where on some servers the DHCP assigned addresses needs to be converted to static. Since there is always more than one…I needed to script it.

Here is a quick way to do it via PowerShell.

Hope this helps!

Add Alternate Email Address or Recovery Email Address for Office365 Administrator

In Office365, depending on the admin role of an account you may want to add an alternate email address for password recovery. This is a basically a self-service password reset for Administrators of Office365.

Quick way to do this is with PowerShell:

If this setting is unset for an administrator, Office365 gives you a nice reminder about adding an alternate email address in case your primary account gets locked out.

You can add this information when first setting up the account:

It can also be added for an existing admin user by going to the Gear, Office 365 settings, and edit your settings in the ‘me’ section, you can enter your mobile phone number and alternate email there.

Resolve IP Addresses from List of Host Names

If you have a list of hostnames/servers that you need IP addresses for its cumbersome to ping each server and get the ip address.

PowerShell to the rescue!

To do this we need a file called Server.txt with each server’s hostname on each line. I am storing the file in D:\Data\Servers.txt.

Once we run the script below it resolves the ip via DNS and stores to another file called D:\Data\Addresses.txt.

All the IP addresses are getting pulled from their DNS value. 

Creating Security Groups for File Shares in Bulk using PowerShell

Security Groups are great for managing large groups for permissions.  A client requested that they needed to have Read-Only, Read-Write, and Ready-Modify (allow for deleting) for all their file shares for better management.

Getting the Share Names

In order for me to create the groups I needed the share names. PowerShell to the rescue!

Type the following on the File Server/ Cluster to list all the shares and capture the output in a text file:

On your file-server you may have a lot of share but for example purposes I am showing just one.

Output should be similar to:

Cleaning up the Share Names

Now that we have the Share names we need to do a bit of cleanup to avoid having duplicates.

  • We need to remove all entries for hidden shares “$”
  • We need to remove duplicates
  • We need to change the case of the share names to lower case. ( I prefer lowercase but you can decide to do what best fits your needs)

Follow my guide to removing duplicates in a text file using NotePad++

Once the sharenames are clean save it to a text file.

Client Requirement for the Security Groups:

For each file share there are three security groups needed:

  • <Sharename>_RO : Read-Only
  • <Sharename>_RW : Read & Write
  • <Sharename>_RM : Read & Modify

For PowerShell to do this I needed to create a .CSV file with all the security group entries.  Now, there are many ways this can be done. I will share what I have been doing.

Open up Microsoft Excel and copy the share on a column to the right (lets say K2)

Now on Cell A2 your value should be =CONCATENATE(K2,"_RW") and drag it down.

It should look something like this:

Do the same for RO & RM. Now you have all the security groups names you need to create.

Create a file called  FileShares_Groups.csv  using the following format.

Create the file Create Security Groups for File Shares.ps1

Copy the two files: FileShares_Groups.csv & Create Security Groups for File Shares.ps1  into a folder called C:\scripts  on the Domain Controller.

Run the PowerShell script and see the security groups get created.

 

 

Remove duplicates, blank lines, spaces, to get unique values and sort data in one operation

From time to time I come across this need; where I need to scrub a file where there are duplicates, there are blank lines, the sort order is all wack, and it just needs to be formatted to where it can be more readable and/or usable.

This method just doesn’t apply to text, but also applies to numbers.

Software Prerequisites:

  • NotePad++
  • TextFX Characters Plug-in for NotePad++

Enabling TextFX Characters Plug-in

Install NotePad++ with all defaults

Goto Plugins > Plugin Manager > Show Plugin Manager

Install TextFX Characters Plugin

Once successfully downloaded it will prompt for a restart.

After a successful restart of the application you should now see the TextFX entry in the toolbar.

Removing duplicates, blank lines, and sorting data

  • Paste the text into Notepad++ (CTRL+V). As you can see, there were lines and half of them were blank.

  • Mark all the text (CTRL+A). Click TextFX → Click TextFX Tools → Check +Sort outputs only UNIQUE (at column) lines (if not already checked).

  • Click TextFX → Click TextFX Tools → Click Sort lines case insensitive (at column)

  • Duplicates and blank lines have been removed and the data has been sorted alphabetically. (The first line that may appear empty contains a space, which is regarded as a character and is included in the list of unique data.)

Changing to lowercase

To change the text to lowercase Goto: TextFX > TextFX Characters > lower case

This has saved me a lot of time when working with IP addresses or cleaning up text.

 

How to force update GlobalAddressList in Office 365?

This post explains how to manually force and update the global address list in Office 365.

Updating the global address list requires to have the Address List Management role. By default, nobody has this role.

1. Assign the AddressList Management role

    • Login with your administrator account to the Office 365 portal.
    • Go to Exchange Admin center, Permissions and admin roles.
    • Create a new role group and assign the AddressList role.addresslistrole

2. Update the AddressList

Once you have the AddressList role assigned, you can use the powershell commands to update the address list. You will have to wait for sometime until the new cmdlets are available.

  • First thing, logon to Exchange online using PowerShell.
  • Run the command Get-AddressList and verify that it’s working. (This may take some to work after creating the role)
  • Run Set-AddressList -Identity All users
  • Your address book is now updated

Windows: Hide Internet Explorer 11 address bar & navigation bar

Applies to:

Windows Server 2008R2, Windows Server 2012R2, Windows 10

There are two ways this can be accomplished depending on your needs for the controlled environment.

GPO:

I would like to first clarify that there is not a single GPO to just hide TABS in IE11. There is however a way you can enforce IE in Full View Mode which by default will remove the TABS and Address bar via a GPO.

The GPO  you can use to enforce the Full-Screen view is available on both Computer and User configuration policy. Below is the gpo location path in group policy editor console.

  • GPO NAME: Enforce full-screen mode
  • LOCATION: Computer or User configuration – Computer Configuration\Administrative Templates\Windows Components\Internet Explorer
  • KEY LOCATION: Software\Policies\Microsoft\Internet Explorer\Toolbars\Restrictions

SCREENSHOT: GPO CONSOLE

2352.GPO-LOCATION

WINDOWS REGISTRY:

This will cause the IE address bar to not show. I disabled the Navigation bars too so it gives a clean window experience.

SCREENSHOT: REGISTRY LOCATION WITH VALUES

1172.GPO-REGISTRY-LOCATION

Download the Registry file.

The GPO and keys will cause the browser to open in full view with no address bar or tabs

7536.FULL-VIEW-AFTER-GPO

Excel: Check email addresses in bulk if format is correct or not

So had a request today to clean up email addresses as some of them were not valid. This was needed for over 1500 email addresses.

So used the formula below and was able to find all addresses that were “FALSE”. I filtered them out and was able to fix them as needed.

Here’s what you need to do:

If your e-mails are in A column, go in the B column and in the B1 cell and copy paste this code:

Then, go down and left on the B1 cell so you can copy and paste the code to the other cells.  For all the valid e-mails, it will give you ‘TRUE’ and for the invalid ‘FALSE’.

2016-08-25_14-34-49