header image

Archive for November, 2019

Get-Counter

Posted by: | November 30, 2019 Comments Off on Get-Counter |

The Get-Counter cmdlet returns in PowerShell v7 preview 6. Its only Get-Counter though the Import/Export-Counter cmdlets aren’t available. Get-Counter isn’t experimental feature so its available as soon as you install preview 6. PS> Get-Command Get-Counter -Syntax Get-Counter [[-Counter] <string[]>] [-SampleInterval <int>] [-MaxSamples <long>] [-Continuous] [-ComputerName <string[]>] [<CommonParameters>] Get-Counter [-ListSet] <string[]> [-ComputerName <string[]>] [<CommonParameters>]   There’s […]

under: PowerShell 7

Clipboard cmdlets

Posted by: | November 26, 2019 Comments Off on Clipboard cmdlets |

The clipboard cmdlets return in PowerShell v7 preview 6 Get-Clipboard and Set-Clipboard are back and according to the release notes work cross platform. PS> Get-Command Get-Clipboard -Syntax Get-Clipboard [-Raw] [<CommonParameters>]   PS> Get-Clipboard Clipboard test   The Raw parameter makes Get-Clipboard ignore new line characters and get the entire contents of the clipboard. PS> Get-Clipboard […]

under: PowerShell 7

Clear-RecycleBin

Posted by: | November 25, 2019 Comments Off on Clear-RecycleBin |

The Clear-RecycleBin cmdlet returns in PowerShell v7 preview 6 on Windows PS> Get-Command Clear-RecycleBin -Syntax Clear-RecycleBin [[-DriveLetter] <string[]>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]   To use PS> Clear-RecycleBin   Will ask for confirmation you want to perform the action PS> Clear-RecycleBin -Force or PS> Clear-RecycleBin -Confirm:$false   Will bypass the need for confirmation

under: PowerShell 7

Fibonacci series

Posted by: | November 23, 2019 Comments Off on Fibonacci series |

Today’s date 23 November is 1123 id written as month then day. Those numbers are the start of the Fibonacci series. So as its Fibonacci day here’s a quick PowerShell function to create a Fibonacci series.   function new-fibonacci { param ( [int]$numberofelements = 10 ) ## first 2 elements $ell1 = 1 $ell1 $ell2 […]

under: PowerShell

PowerShell v7 preview 6

Posted by: | November 22, 2019 Comments Off on PowerShell v7 preview 6 |

PowerShell v7 preview 6 has arrived – https://github.com/PowerShell/PowerShell/releases Its the last preview, as the Release candidate should appear next month, so this version is a good indication of what’ll be available in PowerShell v7.   Test-Connection finally works properly and is usable   Some graphical based cmdlets are now available Out-GridView Show-Command Get-Help –ShowWindow   A […]

under: PowerShell 7

Get-DnsServerResourceRecord

Posted by: | November 21, 2019 Comments Off on Get-DnsServerResourceRecord |

You saw how to discover the zones on a DNS server in the first post in this series. Now its time to discover the records in a zone. For that you need Get-DnsServerResourceRecord.   The syntax is: Get-DnsServerResourceRecord [-ZoneName] <string> [[-Name] <string>] [-Type] <ushort> [-ComputerName <string>] [-Node] [-ZoneScope <string>] [-VirtualizationInstance <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] […]

under: DNS, PowerShell v6

Searching Active Directory by email address

Posted by: | November 21, 2019 Comments Off on Searching Active Directory by email address |

I was asked recently about searching Active Directory by email address and returning the first and last names of the users. First off I needed to populate the first and last name and email fields as they weren’t set in my test domain Get-ADUser -Filter * -SearchBase ‘OU=UserAccounts,DC=Manticore,DC=org’ | foreach { $names = $_.Name -split […]

under: PowerShell and Active Directory

DNS zones

Posted by: | November 20, 2019 Comments Off on DNS zones |

I’m working through the commonly used DNS server cmdlets to determine if everything works in PowerShell core. First up is the cmdlet to get the DNS zones on your DNS server.   PS> Get-DnsServerZone | Format-List -Property ZoneName, ZoneType, IsAutoCreated, IsDsIntegrated, IsReverseLookupZone, IsSigned ZoneName : _msdcs.Manticore.org ZoneType : Primary IsAutoCreated : False IsDsIntegrated : True […]

under: DNS, PowerShell v6

Get-Hotfix

Posted by: | November 19, 2019 Comments Off on Get-Hotfix |

Get-Hotfix returns to PowerShell in PowerShell v7 preview 5 – at least on Windows.   PS> Get-Command Get-HotFix -Syntax Get-HotFix [[-Id] <string[]>] [-ComputerName <string[]>] [-Credential <pscredential>] [<CommonParameters>] Get-HotFix [-Description <string[]>] [-ComputerName <string[]>] [-Credential <pscredential>] [<CommonParameters>]   It still uses the Win32_QuickFixEngineering CIM class under the covers which is why its Windows only.   My preferred […]

under: PowerShell 7

Categories