-
-
Notifications
You must be signed in to change notification settings - Fork 9
π§Ή chore: code quality audit β fix critical, high, medium, and low bugs #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9c2927f
π fix(scripts): fix all critical code bugs found during audit
SamErde 28005d5
π fix(function): resolve high-severity bugs in AD, DNS, Exchange, andβ¦
SamErde 23f3ffe
π fix(function): resolve medium-severity bugs across scripts
SamErde e69154f
π§Ή chore(function): remove dead code re-fetch of ProductKey at EOF
SamErde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,47 @@ | ||
| [CmdletBinding()] | ||
| param ( | ||
| # The OU or container in Active Directory to search for servers. | ||
| [Parameter(Mandatory)] | ||
| [string] $SearchBase, | ||
|
|
||
| # The Active Directory domain controller to query. | ||
| [Parameter(Mandatory)] | ||
| [string] $ADServer, | ||
|
|
||
| # The DNS server addresses to assign to network adapters on the target servers. | ||
| [Parameter(Mandatory)] | ||
| [string[]] $DNSServerAddresses | ||
| ) | ||
|
|
||
| Import-Module ActiveDirectory | ||
| $servers = Get-ADComputer -SearchBase "" -Server "" -SearchScope Subtree -Filter * | ||
| $servers = Get-ADComputer -SearchBase $SearchBase -Server $ADServer -SearchScope Subtree -Filter * | ||
| foreach ($server in $servers) | ||
| { | ||
| # Connect to the server. | ||
| $serverName = $server.Name | ||
| Write-Output "Connecting to $serverName" | ||
| $s = $null | ||
| try { | ||
| # Create and connect to the PSSession. | ||
| $s = New-PSSession -ComputerName $serverName | ||
| Enter-PSSession $s -ErrorAction SilentlyContinue | ||
| # Create the PSSession. Enter-PSSession is interactive-only and cannot redirect script commands remotely. | ||
| $s = New-PSSession -ComputerName $serverName -ErrorAction Stop | ||
| } | ||
| catch { | ||
| # Log the failure and continue the for loop on the next item. | ||
| Write-Output "Failed connection to $serverName" | ||
| Continue | ||
| } | ||
|
|
||
| # Connected to session. Now updated the DNS client server address on any interfaces that currently use a domain controller IP. | ||
| # Connected to session. Now update the DNS client server address on any interfaces that currently use a domain controller IP. | ||
| try { | ||
| Get-NetIPInterface | Get-DnsClientServerAddress | Where-Object {$_.ServerAddresses -like '10.10.10.*'} | ` | ||
| Set-DnsClientServerAddress -ServerAddresses ("","","") -Verbose | ||
| Invoke-Command -Session $s -ScriptBlock { | ||
| Get-NetIPInterface | Get-DnsClientServerAddress | Where-Object { $_.ServerAddresses -like '10.10.10.*' } | | ||
| Set-DnsClientServerAddress -ServerAddresses $using:DNSServerAddresses -Verbose | ||
| } | ||
| } | ||
| catch { | ||
| Write-Output "Failed to change the DNS client server address on $servername" | ||
| Write-Output "Failed to change the DNS client server address on $serverName" | ||
| } | ||
| finally { | ||
| if ($s) { Remove-PSSession -Session $s } | ||
|
SamErde marked this conversation as resolved.
|
||
| } | ||
| Exit-PSSession | ||
| } # End foreach server loop. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.