Skip to content

Commit

Permalink
test remote deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
metablaster committed Jun 3, 2023
1 parent 1260813 commit 87f2b93
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ function Search-Installation
[System.Environment]::ExpandEnvironmentVariables($Path)
}

if (Test-Path $ExpandedPath)
if (Invoke-Command @SessionParams -ArgumentList $ExpandedPath -ScriptBlock { Test-Path $ExpandedPath })
{
$VersionFolders = Invoke-Command @SessionParams -ArgumentList $ExpandedPath -ScriptBlock {
param ($ExpandedPath)
Expand Down
4 changes: 2 additions & 2 deletions Modules/Ruleset.Remote/Public/Enable-RemoteRegistry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function Enable-RemoteRegistry
foreach ($RuleGroup in $AllRuleGroups)
{
# Remove rules before copying over fresh ones
Get-NetFirewallRule -Group $RuleGroup -PolicyStore $Store -Direction Inbound |
Get-NetFirewallRule -Group $RuleGroup -PolicyStore $Store -Direction Inbound -ErrorAction Ignore |
Where-Object { $_.Profile -like $RuleProfile } | Remove-NetFirewallRule
Get-NetFirewallRule -Group $RuleGroup -PolicyStore $Store -Direction Outbound |
Get-NetFirewallRule -Group $RuleGroup -PolicyStore $Store -Direction Outbound -ErrorAction Ignore |
Where-Object { $_.Profile -like $RuleProfile } | Remove-NetFirewallRule

# Copy only rules which were removed, ignore the rest
Expand Down
4 changes: 2 additions & 2 deletions Modules/Ruleset.Remote/Public/Enable-WinRMServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ function Enable-WinRMServer

if ($Loopback)
{
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Enabling WinRM loopback server..."
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Enabling WinRM loopback server for '$($Protocol)' protocol ..."
}
else
{
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Enabling WinRM remoting server..."
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Enabling WinRM remoting server for '$($Protocol)' protocol ..."
}

<# MSDN: The Enable-PSRemoting cmdlet performs the following operations:
Expand Down
2 changes: 1 addition & 1 deletion Modules/Ruleset.Remote/Public/Set-WinRMClient.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function Set-WinRMClient

$MachineName = Format-ComputerName $Domain
. $PSScriptRoot\..\Scripts\WinRMSettings.ps1 -IncludeClient -AllowUnencrypted:($Protocol -ne "HTTPS")
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Configuring WinRM client..."
Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Configuring WinRM client for '$($Protocol)' protocol ..."

# TODO: Initialize-WinRM and Unblock-NetProfile are called multiple times since multiple functions are needed for configuration
Initialize-WinRM
Expand Down
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,15 +586,6 @@ one is called management computer (client) and all others are called managed com
Scripts are executed by administrator on management computer, and firewall is then deployed to or
configured on multiple server computers simultaneously.

At the moment the following remoting capabilities are implemented:

1. Automatic creation of PS and CIM sessions
2. Drilling registry remotely
3. Configuring WinRM service
4. Establishing encrypted session to remote host
5. Gethering information about remote computers
6. Deploying firewall to single remote computer on same subnet that is not part of domain

For implementation details see `Modules\Ruleset.Remote` module

**NOTE:** Remoting functionality is not exclusive to remote firewall deployment, deployment to
Expand Down Expand Up @@ -638,7 +629,6 @@ configured in PowerShell Core then client computer also needs PowerShell core fo
If either the server or management computer is a workstation (ex. not Windows server or part of domain)
then it's network profile must be set to private profile.

This is how remote deployment is going to work once this functionality gets fully implemented.\
Remote deployment can be customized in a great detail in the following locations:

- To customize WinRM service see: `Modules\Ruleset.Remote\Scripts\WinRMSettings.ps1`
Expand Down
10 changes: 0 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,6 @@ one is called management computer (client) and all others are called managed com
Scripts are executed by administrator on management computer, and firewall is then deployed to or
configured on multiple server computers simultaneously.

At the moment the following remoting capabilities are implemented:

1. Automatic creation of PS and CIM sessions
2. Drilling registry remotely
3. Configuring WinRM service
4. Establishing encrypted session to remote host
5. Gethering information about remote computers
6. Deploying firewall to single remote computer on same subnet that is not part of domain

For implementation details see `Modules\Ruleset.Remote` module

**NOTE:** Remoting functionality is not exclusive to remote firewall deployment, deployment to
Expand Down Expand Up @@ -639,7 +630,6 @@ configured in PowerShell Core then client computer also needs PowerShell core fo
If either the server or management computer is a workstation (ex. not Windows server or part of domain)
then it's network profile must be set to private profile.

This is how remote deployment is going to work once this functionality gets fully implemented.\
Remote deployment can be customized in a great detail in the following locations:

- To customize WinRM service see: `Modules\Ruleset.Remote\Scripts\WinRMSettings.ps1`
Expand Down

0 comments on commit 87f2b93

Please sign in to comment.