-
How to manage and configure BitLocker Drive Encryption – PowerShell and BitLocker on Windows Server 2012 R2
I have heared a lot of questions and a lot of incorrect answers about BitLocker in enterprise environments so I decided to write a series of articles to demystify BitLocker and its management. BitLocker – Difference between Windows 8.1 (client OS) and Windows Server 2012 R2 The most important difference is that you need to…
-
Simple PowerShell script to combine every item with every item
I needed a simple PowerShell code to generate hash tables with all possible pairs of a given array of strings. There are possibilities to use a similar method in .NET but I used only PowerShell functionality. This is my output: $inputItems = ‘aaa’, ‘bbb’, ‘ccc’ $pairItems = @() $i = 0 foreach ($pairItemFirst in $inputItems) {…
-
PowerShell advanced function (cmdlet) to get all Active Directory Sites and Subnets
I wrote a simple function to get all AD sites and subnets. Using this function it is possible to easily report all sites and for example find sites without subnets. If there is more then on subnet in a site then the output is multiple objects with the same site and different subnet. Every object…
-
PowerShell advanced function (cmdlet) to modify existing shortcuts (links, LNK files) to start app in elevated mode (Run as Administrator)
I needed to modify tens of existing shortcuts to run referenced applications in elevated mode. It is possible to do it in properties of the shortcut (Advanced – [x] Run as administrator) but I prefer PowerShell (actually .NET Framework) to do bulk operations. I wrote this function for you. Function Set-RvShortcutToRunAsAdministrator { <# .SYNOPSIS Modify…
-
Convert object in PowerShell (for example [PsCustomObject]) into hash table source code
I needed a simple and reusable PowerShell code to convert any object into hash table that can be copy and pasted as source code. I wrote this: $outputItem = ‘@{‘ $MyCustomObject.PSObject.Properties.Name | Where-Object -FilterScript { $_ -ne ‘ComputerName’ } | ForEach-Object -Process ` { if ($interfaceItemIpConfigurationItem.$_ -is [bool]) { $valueItem = ‘${0}’ -f $MyCustomObject.$_.ToString().ToLower() }…