Overview for snippest

Elevated Shell?

Somtime you have to verify if your PowerShell session runs with elevated permissions. With this short code you can check it and inform the user or stop the script if elevated permissions are required. If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetC…

Read more

Written by Arne Tiedemann on Friday June 1, 2018

Image: 2018-06/tit-powershell-sw.png

LastLogonTimestamp

Sometimes you have to identify the last logon of a user or computer object in Active Directory. With this little code, you can list all users/computers ordered from old to new logins. Get-ADComputer -Filter * -SearchBase "OU=<OU>,DC=<DC>,DC=DC=<DC>" -Server "Domain …

Read more

Written by Arne Tiedemann on Monday June 18, 2018

Image: 2018-06/tit-powershell-sw.png

Powershell New-Credential

Sometimes you need a credential object in scripts to run that script unattended. This article describes a way to create a credential object to use it in interactive and non-interactive scripts. Common Scripts Interactive-Mode You can create the PSCredential object by using Get-Creden…

Read more

Written by Arne Tiedemann on Wednesday June 20, 2018

Image: 2018-06/tit-powershell-blue.png

Active Directory NO_CLIENT_SITE report

As an Active Directory administrator, you have to do recurring tasks. One task is to check if client subnets are pointed to an Active Directory site and if not Domain Controllers will log this message in the following log file and print a warning message at the event log. EventLog ID: 5807  …

Read more

Written by Arne Tiedemann on Friday June 22, 2018

Image: 2019-06/apple-black-and-white-black-and-white-169573.jpg

Fast way to access group memberships

Sometimes you have to ask for your own group membership or you write a script and have to get the memberships. Everybody knows the command whoami but does you know that you can convert it to CSV with PowerShell. WHOAMI /GROUPS /FO CSV /NH | ConvertFrom-Csv -Header 'GroupName','Type','SID','…

Read more

Written by Arne Tiedemann on Tuesday July 17, 2018

Image: 2019-06/codes-electronics-laptop-214221.jpg

How to get Operatingsystem from all domain controllers in the forest

Sometimes you need to know the Windows Version of all domain controllers in the forest. This short snippet can help to find all domain controllers in the entire forest. <# Get all Domain Controllers Windows Versions #> # Set variables $ADDomainController = @() $Domains = …

Read more

Written by Arne Tiedemann on Tuesday October 23, 2018

Image: 2019-06/apple-black-and-white-black-and-white-169573.jpg

PowerShell UG UK

twitter https://twitter.com/GetPSugUK Hear about all the UK PowerShell UserGroups as the community grows in 2019 - run by members of the #UK #PowerShell community

Read more

Written by Arne Tiedemann on Sunday August 4, 2019

PowerShell Scripts

twitter https://twitter.com/PoshCode We are the PowerShell script Repository

Read more

Written by Arne Tiedemann on Sunday August 4, 2019

Remove-MyDHCPServerv4Reservation

If you have more than one DHCP Server and you want to remove dhcp reservation on all of your servers, you can use these functions for that. function Remove-MyDHCPv4Reservation { <# .SYNOPSIS This Cmdlet add an dhcp reservation on both dhcp servers .DESCRIPTION This Cmdlet …

Read more

Written by Arne Tiedemann on Wednesday November 21, 2018

Image: 2018-06/tit-powershell-blue.png

Domain Controller Zip Security Archiv

In some environment, it is necessary to enable event log archiving for local event logs. This article describes how to identify the archives and zip the archives to save storage place.

Read more

Written by Arne Tiedemann on Tuesday August 13, 2019

Image: 2019-06/artificial-intelligence-blur-close-up-546819.jpg

Add-MyDHCPServerv4Reservation

If you have more than one DHCP server and you want to add DHCP reservation on all of your servers, you can use these functions for that. function Add-MyDHCPv4Reservation { <# .SYNOPSIS This Cmdlet add an dhcp reservation on both dhcp servers .DESCRIPTION This Cmdlet add an dhcp …

Read more

Written by Arne Tiedemann on Tuesday November 20, 2018

Image: 2018-06/tit-powershell-blue.png

DHCP Server DNS Updates

If you use a Microsoft DHCP Server with many scopes and you have to check each scope configuration.....

Read more

Written by Arne Tiedemann on Tuesday August 13, 2019

Image: 2019-06/art-artist-artistic-316465.jpg

Recreate Exchange Mailbox with legacyExchangeDN and emailaddresses

Sometimes when you want to move a mailbox from Exchange 2010 to Exchange 2013 or 2016 the move request stops with the following error: MigrationMRSPermanentException: MapiExceptionUnexpectedType: Unable to query table rows StoreEc: 0x80040304 And you have already installed …

Read more

Written by Arne Tiedemann on Monday July 2, 2018

Image: 2019-06/black-and-white-close-up-cubes-1591062.jpg

The missing Set-GPPermission PowerShell function

Sometimes administrators have to set DenyApply permission on many group policies. How can an admin do this but default GroupPolicy PowerShell Module does not have this function. 

Read more

Written by Arne Tiedemann on Wednesday September 11, 2019

Image: 2019-06/codes-electronics-laptop-214221.jpg