This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| DNS Made Easy helper functions | |
| Context: I needed to do some bulk operations in DNS Made Easy at work, | |
| I didn't find anything adequate online and so I wrote this. | |
| .DESCRIPTION | |
| This file exposes 3 functions, an enum and a class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file contains the following functions: | |
| # Import-ServiceCertificate - Import a PFX certificate to a service cert store | |
| # Get-ServiceCertificate - Get the certificates of a service | |
| # Remove-ServiceCertificate - Delete a certificate from a service | |
| #Requires -RunAsAdministrator | |
| function Import-ServiceCertificate { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-ImageFromHub { | |
| <# | |
| .SYNOPSIS | |
| Find the docker image for the current Windows Server OS from Docker Hub. | |
| Additionally it can also inspect the image and get its size (from all of its layers) | |
| NOTE: This function does not download the docker image, just its metadata. | |
| The -ShowSize switch requires the docker tool. | |
| .EXAMPLE | |
| Get-ImageFromHub -ShowSize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-ProcessWithService { | |
| <# | |
| .SYNOPSIS | |
| Get the processes along with the relevant service associated to each process (if any) | |
| This is the equivalent to "tasklist /svc" cmd command. | |
| .EXAMPLE | |
| Get-ProcessWithService | where Service | select ProcessId,Name,Service | |
| .NOTES | |
| WMI Query Language (WQL) WHERE Clause | |
| https://learn.microsoft.com/en-us/windows/win32/wmisdk/where-clause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this hashtable is used on the extension name validation for the input | |
| # it is also used to get the extension id | |
| $script:VSCodeExtensions = @{ | |
| 'vscode-icons' = 'vscode-icons-team.vscode-icons' | |
| powershell = 'ms-vscode.powershell' | |
| csharp = 'ms-dotnettools.csdevkit' | |
| terraform = 'hashicorp.terraform' | |
| } | |
| # Note: if this was a module, we could have this in a .psd1 file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ENV variable | |
| $env:COMPUTERNAME | |
| # Note: this is limited to 15 characters | |
| # native C++ | |
| hostname.exe | |
| # Note: this shows the full name <<===== | |
| # environment class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Test-ADCredential { | |
| <# | |
| .Synopsis | |
| Verify Active Directory credentials | |
| .EXAMPLE | |
| Test-ADCredential -Username user1 -Password Secret01 | |
| #> | |
| [CmdletBinding(DefaultParameterSetName = 'PSCreds')] | |
| [OutputType([Boolean])] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Resolve-AmazonArn { | |
| <# | |
| .SYNOPSIS | |
| Parse an Amazon Resource Name (ARN) into its individual parts. | |
| .EXAMPLE | |
| 'arn:aws:iam::111222333444:role/MyRole' | Resolve-AmazonArn | |
| .EXAMPLE | |
| Resolve-AmazonArn arn:aws:s3:::MyBucket/MyFolder/* | |
| .EXAMPLE | |
| Resolve-AmazonArn s3://MyBucket/MyFolder/MyFile.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Start-RunspaceJob { | |
| <# | |
| .SYNOPSIS | |
| It runs a command on a timer, so it can abort the command if the timeout expires. | |
| It can also run the command as a different user. | |
| It allows the end-user to pass input parameters to the command. | |
| .EXAMPLE | |
| Start-RunspaceJob -Scriptblock { | |
| $p1 = ' ' * 9 ; $p2 = ' ' * 18 | |
| Write-Verbose "$p1 1 [V] Will do A" -Verbose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-AmazonApiOperation { | |
| <# | |
| .SYNOPSIS | |
| Show the relevant AWS API Operation for a given PowerShell command | |
| .DESCRIPTION | |
| This function comes handy when writing permissions for IAM roles. | |
| Because you need to know the actions (as-in API operations) that you want to allow in the IAM policy. | |
| .EXAMPLE | |
| Get-Command -Noun EC2Tag | Get-AmazonApiOperation |
NewerOlder