# An Investment in Knowledge

A personal Wiki where I keep what I've learned in my career in Information Technology and what I want to learn going forward.

> "An investment in knowledge pays the best interest." -Benjamin Franklin

Information Technology is an ever evolving industry and to be effective in this industry, you must evolve with it, or be left behind.

This Wiki will serve as a reference point for the information I need to do my job today and for the information I need for growth tomorrow.


# Microsoft Windows

Desktop or Server, you'll find it here


# CMD: Disable Windows 10 Reset

Users Resetting their PC thinking it was Restart? Users trying to hide thing by resetting their PC? Do this:

```
reagentc.exe /disable
```


# CMD: Fix Windows Key Activations

Windows 10, Windows Server 2016, and Windows Server 2019

Run ***Command Prompt*** as Administrator and enter the following command:

```
slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
```

Where the "xxxxx" represet the Activation Key for the OS.


# CMD: FSMO Role Transfer

## Prerequisite Check

Open **Event Viewer** and check ***Applications and Service logs*** for errors in the following:

* ADWS
* DFS Replication
* Directory Service
* DNS Server

If these services are good, then it is safe to proceed with FSMO Role transfer.

## Transfer FSMO roles using NTDSUtil tool

1. Open **Command Prompt** with elevated privileges (**Run as Administrator**)
2. Type **ntdsutil** and press **Enter**
3. Type **roles** and press **Enter**
4. Type **connections** and press **Enter**
5. Type the following:
   1. **connect to server "SERVERNAME"** and press **Enter**
   2. Where "**SERVERNAME"** is the name of the server FSMO roles are being transferred to

This sets the FSMO role transfer location. Now, one by one, each role needs to be transferred using the command(s) below. After each **Enter** at the end of each command, a pop-up confirmation window will appear - click **Yes** to continue.

```
transfer schema master >>> press Enter
transfer rid master >>> press Enter
transfer naming master >>> press Enter
transfer pdc >>> press Enter
transfer infrastructure master >>> press Enter

```

When each role has been transferred to new server, it is safe to quit out of the NTDSUtil tool. Type **quit** and press **Enter**.

Once these roles are confirmed on the new server, the old server can be decommissioned or features/roles removed (i.e. Active Directory).


# De-Bloat Windows 10

Powershell Script to remove Windows 10 bloatware

Run Powershell as Administrator and input the following command:

```
iex ((New-Object System.Net.WebClient).DownloadString('https://git.io/debloat'))
```

After a few seconds, a window will be displayed with several buttons. The buttons are self-explanatory. Use as many or as little as necessary to clean up your Windows 10 installation.

{% hint style="info" %}
IMPORTANT!

If possible, do not connect a device to the Internet. This will prevent Microsoft Windows from immediately downloading freeware/bloatware on the system.

If the system has already been in use, disconnect from the network/Internet and run this command. Once completed, restart the system, re-connecting to the network during or after reboot.
{% endhint %}


# Important Links

Links to How-Tos and other important information that I am too lazy to write out myself.

{% embed url="<http://www.vmwarearena.com/vmware-converter-how-to-perform-p2v-and-v2v-migration/>" %}


# Microsoft Exchange Server Search Index Rebuild

When an entire office can no longer search their emails due to lack of network connection (so the error message says), the Database Index may be corrupt.

In the Exchange Management Shell, run the following command:

```
> Get-MailboxDatabaseCopyStatus * | sort name | Select name,status,contentindexstate
```

If it shows failed, disabled, or some other negative status, the following steps will be required.

1. Stop these two services:
   1. HostControllerService
   2. MSExchangeFastSearch
2. Locate the Index Catalog
   1. Could be on C:\\, or it could be on another data drive.
   2. The format of the directory will look like this:
      1. C:\\-\\-\Mailbox Database 00657134726\_Catalog\STRING OF NUMBERS.Number.Single
   3. Rename this directory to .OLD
3. Restart the two services above
4. A new Index Catalog will be created and the database will start to index

{% hint style="info" %}
It may take up to 24 hours for the Index Catalog to complete, sometimes less, sometimes longer. It is wholly dependent on the size of the database.
{% endhint %}

Use the PowerShell command at the top to check the status of the index.


# PowerShell: Export Active Directory Group Members

Query and save members of Active Directory groups. In this case, this is just looking for names of users, but other meta data can be queried as well.

## Verify module(s) in AD

Verify that the Active Directory module is installed in PowerShell

```
Get-Module -ListAvailable
```

## Verify you can find the AD Group

```
Get-ADGroup -filter * | sort name | select name
```

The output of the above command will list all Groups within Active Directory. Verify that the group you need to query is in this list.

## Export List of AD Group Members

```
Get-ADGroupMember -identity "Name of Group" | select name | Export-csv -path C:\name of path.csv
```

Quotes are required around the group name as the names often contain spaces.

The file does not need to exist in the path for it to save; it will be created at time of processing.


# Registry: Mapped Drives Don't Appear

In third-party software, mapped network drives may not appear. This can occur in Windows 7 and Windows 10. The fix for this is to edit a registry setting using the instructions below.

## Enable the *EnableLinkedConnection* registry value

* Click Start and type ***regedit*** in the Start Search box. Press **Enter**.
* Locate and then right-click the following registry subkey:

{% hint style="info" %}
*HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System*
{% endhint %}

* Point to ***New***, and then click ***DWORD Value***.
* Type **EnableLinkedConnections**, and then press **Enter**.
* Right-click ***EnableLinkedConnections***, and then click ***Modify***.
* In the ***Value*** data box, type **1**, and then click **OK**.
* Exit the Registry Editor and restart the computer.


# Robocopy

Command format and option definitions

```
robocopy <src> <dest> /mir /r:1 /w:1 /sec /b
```

## Options

| Option           | Description                                                   |
| ---------------- | ------------------------------------------------------------- |
| /mir             | Mirrors a directory tree                                      |
| /r:\<N>          | Specifies number of retries on failed copies                  |
| /w:\<N>          | Specifies the wait time between retires in seconds            |
| /sec             | Copies files with security                                    |
| /b               | Copies files in Backup mode                                   |
| /xd \<Directory> | Excludes directories that match the specified names and paths |


# SYSVOL Migration to DFRS

Primarily used to move from a Server 2008(R2) or 2012 environment to a Server 2016/2019 environment.

(1) Verify domain is 2008 or above

(2) Verify there are no replication issues using **dcdiag**

### State 0: Start

```
dfsrmig /CreateGlobalObjects
```

Run commands below for each DC for verification:

```
dfsrdiag pollad /member:SERVERNAME

// replace SERVERNAME with name of server to be polled
```

Check the migration state of the server

```
dfsrmig /GetMigrationState
```

### State 1: Preparation

```
dfsrmig /SetGlobalState 1
```

Replication can run on just the DFRS Global Settings

```
repadmin /replsingleobj * SERVERNAME "CN=DFSR-GlobalSettings,
CN=System,DC=NAME,DC=local (or TLD)"
```

Verify **msDFR-Flags 16** is prepared

```
repadmin /showattr * "CN=DFSR-GlobalSettings,CN=System,DC=NAME,DC=local (or TLD)" 
/atts:msDFSR-Flags
```

{% hint style="info" %}
If the above commands do not work, you can manually check using ADSI Edit
{% endhint %}

Run the command below on each DC to verify

```
dfsrdiag pollad /member:SERVERNAME
```

Replicate from the DC, verify there are no errors

```
repadmin /syncall /SAe SERVERNAME
```

Check the migration state

```
dfsrmig /GetMigrationState
```

{% hint style="info" %}
NETLOGON and SYSVOL shares should still point to sysvol net share
{% endhint %}

### State 2: Redirected

```
dfsrmig /SetGlobalState 2
```

Run replication on just the DFRS Global Settings

```
repadmin /replsingleobj * SERVERNAME "CN=DFSR-GlobalSettings,CN=System,DC=NAME,
DC=local (or TLD)"
```

Verfiy msDFR-Flags 32 is redirected

```
repadmin /showattr * "CN=DFSR-GlobalSettings,CN=System,DC=NAME,DC=local (or TLD)"
/atts:msDFSR-Flags
```

{% hint style="info" %}
If the commands above do not work, you can manually check by using ADSI Edit
{% endhint %}

Run the command below to verify for each DC

```
dfsrdiag pollad /member:SERVERNAME
```

Replicate from DC, verify there are no errors

```
repadmin /syncall /SAe SERVERNAME
```

Check the migration state

```
dfsrmig /GetMigrationState
```

{% hint style="info" %}
If the above commands do not work, you can manually check using ADSI Edit
{% endhint %}

### State 3: Eliminated

***This is irreversible - once you go to State 3, there is no going back!***

```
dfsrmig /SetGlobalState 3
```

Run the command below for each DC to verify

```
dfsrdiag pollad /member:SERVERNAME
```

Replicate from DC, verify there are no errors

```
repadmin /syncall /SAe SERVERNAME
```

Check the migration state

```
dfsrmig /GetMigrationState
```

{% hint style="info" %}
NETLOGON and SYSVOL shares should now point to sysvol\_dfsr, and the previous sysvol directory should be deleted.
{% endhint %}

Verify msDFR-Flags 48 is eliminated

```
repadmin /showattr * "CN=DFSR-GlobalSettings,CN=System,DC=NAME,DC=local (or TLD)" 
/atts:msDFSR-Flags
```


# Moving Windows Recovery Partition

Open Command Prompt as Admin

```
reagentc /disable
```

This command disables the recovery partition and moves it into a file named Winre.wim, located in C:\Windows\System32\Recovery.

With Command Prompt still open, perform the following actions:

```
diskpart
```

```
list disk
```

```
select disk ##
```

```
list partition
```

```
select partition ##
```

You are selecting the Recovery Partition at this point. We are going to delete it and then recreate it at the end of the disk space.

```
delete partition override
```

Open Disk Management and check out the disk. The Recovery Partition should be gone. To put the recovery partition back, we will need to expand the disk size, but leave 1024MB of space. So, take the remaining space in the Extend Volume Wizard, subtract 1024, and use that product as the expanded volume size.

On the 1024MB (1GB) unallocated space at the end of the disk, create a New Simple Volume with the following settings:

* Do not assign drive letter
* Volume Label: New Recovery

Click Next and finish the new volume setup. Then, return to your elevated Command Prompt and DiskPart to finish adding the recovery partition back using the following commands:

```
list partition

select partition ##
```

For GPT disks, we need to set the identifier so enter the following command exactly as you see it:

```
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
```

We then need to hide the drive, so again, enter the following command exactly:

```
gpt attributes=0x8000000000000001
```

Note: there are 14 zeros in the number above, if you are unable to copy/paste into a terminal window

Keeping the Command Prompt window open, type the following to Exit DiskPart

```
exit
```

IMPORTANT: Re-enable the Windows Recovery Partition using the following command:

```
reagentc /enable
```


# Microsoft 365


# Export Shared Mailbox Permissions

The link below is to a blog post about a script a reddit user created to pull down all shared mailboxes and their associated members. You can already view shared mailbox information, specifically permissions, by using the Exchange Admin Center. However, you can only review permissions one mailbox at a time. Microsoft also lacks a well formatted output that will show you permissions such as full access, send as, and send on behalf.

The script linked to in the article will format the output of all shared mailboxes, the members, and their subsequent permissions. And the script supports more advanced filtering too through additional PowerShell cmdlets.

#### Link to article with detailed instructions and information:

{% embed url="<https://o365reports.com/2020/01/03/shared-mailbox-permission-report-to-csv/>" %}

#### Link to download the script itself

{% embed url="<https://gallery.technet.microsoft.com/Export-Shared-Mailbox-a3e98676>" %}


# Change Microsoft 365 Update Channel

Typically used to change the channel from Semi-Annual Enterprise to the Current channel release so the latest updates/features added to or improved upon for Microsoft 365 are available to users.

## Identify the Channel

Monthly Channel - Channel=Current\
Semi-annual Channel - Channel=Broad

1. Run Command Prompt as Administrator
2. Change directory

```
cd %programfiles%
cd Common Files\microsoft shared\ClickToRun
```

3\. Execute the following command to change to the desired channel

```
OfficeC2RClient.exe /changesetting Channel=Monthly
```

4\. Execute the following command to start the process of changing the channel and updating Office apps

```
OfficeC2RClient.exe /update user
```

Let the process complete. Launch an Office app, click File > Office Account, and view the build version to verify you have the desired version based on the channel setting. You may need to update Office if the channel change was from Semi-annual to Monthly/Current.


# Apple MacOS

How-tos, important terminal commands, shortcut keys, and apps.

## Links

* [How to Change Folder and App Icons in OS X](https://www.howtogeek.com/211791/how-to-change-folder-and-app-icons-in-os-x/)
* [How to Use Multiple Desktops on a Mac](https://www.howtogeek.com/180677/mission-control-101-how-to-use-multiple-desktops-on-a-mac/)


# Terminal Commands

Commands that I've come across that I've had to use and may be beneficial in the future.

### Mouse Sensitivity Scaling:

```
// Reads the current configuration

default read .GlobalPreferences com.apple.mouse.scaling

//
```

```
// Writes the configuration you set where "#" stand for a number of your
// choosing, i.e. 7.0

default write .GlobalPreferences com.apple.mouse.scaling #.#

//
```


# Linux


# Raspberry Pi

Production, Projects, and Information

## Projects

{% hint style="info" %}
101+ Awesome Raspberry Pi Project - [Pi My Life Up](https://pimylifeup.com/category/projects/)
{% endhint %}

| Project                    | Plan Page                                                                       | Completed Date |
| -------------------------- | ------------------------------------------------------------------------------- | -------------- |
| Pi-hole                    | [Click Here](https://wiki.bryanpcoleman.com/raspberry-pi/pi-hole)               | 08/01/2019     |
| Weather Station            | [Click Here](https://wiki.bryanpcoleman.com/raspberry-pi/weather-station)       |                |
| Kali Linux War Driving Kit | [Click Here](https://wiki.bryanpcoleman.com/raspberry-pi/wardriving-kali-linux) | 11/04/2019     |

## Links

* [How to Use Your Raspberry Pi as a NAS box](https://thepi.io/how-to-use-your-raspberry-pi-as-a-nas-box/)
* [How to Turn Your Raspberry Pi into a Plex Server](https://www.howtogeek.com/400958/how-to-turn-a-raspbery-pi-into-a-plex-server/)
* [Build Your Own Weather Station](https://projects.raspberrypi.org/en/projects/build-your-own-weather-station)
* [How to Add a Power Button to your Raspberry Pi](https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi)


# pi-Hole


# Weather Station


# Wardriving Kali Linux


# Raspbian Tweaks

Raspbian OS tweaks for personal taste or for better functionality.

## Official 7-inch Screen

These are tweaks for modifying the way the *Raspberry Pi Official 7-inch Screen* displays its output.

### Change Screen Rotation

Edit the **/boot/config.txt** with the following:

```
sudo nano /boot/config.txt

// Place at top of file

lcd_rotate=2
```

Reboot the Raspberry Pi with the following command:

```
sudo reboot
```

### Change Screen Resolution

Change the default 800x480 resolution, editing the **/boot/config.txt** file with the following:

```
sudo nano /boot/config.txt

// change Frame Buffer Lines to the following:

framebuffer_width=1024
framebuffer_height=614
```

Reboot and check the resolution with this command:

```
fbset -s
```

These frame buffer sizes appear to be the best balance between quality and achievable resolution, but can be modified to suit a user's needs.


# Data Privacy Restoration Journey

Data conglomerates have broken down privacy barriers in the name of profits, and it is time to reclaim what is rightfully mine.

## Projects

| Project   | Plan Page                                                                               | Completion Date |
| --------- | --------------------------------------------------------------------------------------- | --------------- |
| Bitwarden | [Click here](https://book.bryanpcoleman.com/data-privacy-restoration-journey/bitwarden) |                 |
| Nextcloud | [Click here](https://book.bryanpcoleman.com/data-privacy-restoration-journey/nextcloud) |                 |
| openHAB   | [Click here](https://book.bryanpcoleman.com/data-privacy-restoration-journey/openhab)   |                 |

## Links

* [The Complete List of Alternatives to All Google Products](https://www.techspot.com/news/80729-complete-list-alternatives-all-google-products.html) - moving away from Google is step one and perhaps the hardest and most complex move of all


# Bitwarden

{% hint style="info" %}
[Bitwarden](https://bitwarden.com)
{% endhint %}


# Nextcloud

Self-hosting of data, calendars, contacts, and so much more!

Nextcloud is a self-hosted platform that allows you, the owner of data, to be in complete control of said data. As a user of cloud storage such as OneDrive, Google Drive, and Dropbox, I have literrally no control over what those providers do with the data and metadata I store within their service(s).

Nextcloud places control of documents and photos, calendars, and contacts in your hands. It is easy to setup provided you have a little technical know-how and can read the How-To linked below. This page will become a diary of progress, from setup to complete usage of the Nextcloud software.

{% hint style="info" %}
[Nextcloud Support](https://nextcloud.com/support/)

[Nextcloud Admin Documentation](https://docs.nextcloud.com/server/17/admin_manual/)

[Nextcloud User Manual](https://docs.nextcloud.com/server/17/user_manual/)
{% endhint %}


# openHAB

{% hint style="info" %}
[openHAB](https://www.openhab.org/docs/tutorial/configuration.html)
{% endhint %}


