How To Setup WinRM, CIFS Manually

Objective

This procedure will setup a Windows desktop or server to allow connections and Automation from Attune. This is done via enabling Windows File Sharing (CIFS) and Windows Remote Management (WinRM).

Procedure

To enable WinRM, run the following command in PowerShell.

# IMPORTANT, Update this to the IP address
# of the host running Attune
$allowIp="127.0.0.1/32"

# Create a firewall rule to allow WinRM
New-NetFirewallRule `
    -DisplayName 'WinRM HTTPS' `
    -Name 'WinRM_HTTPS' `
    -Profile Any `
    -LocalPort 5986 `
    -Protocol TCP `
    -RemoteAddress $allowIp

# Enable WinRM with HTTPS, via PowerShell
# This is for windows deployment step
Enable-PSRemoting -SkipNetworkProfileCheck -Force

# Remove existing listeners
Remove-Item `
    -Path WSMan:\Localhost\listener\listener* `
    -Recurse

# Create self signed certificate and
New-Item `
    -Path WSMan:\LocalHost\Listener `
    -Transport HTTPS `
    -Address * `
    -CertificateThumbPrint (
        New-SelfSignedCertificate `
        -CertstoreLocation Cert:\LocalMachine\My `
        -DnsName $env:computername `
        -NotAfter (get-date).AddYears(6)
    ).Thumbprint `
    -Force

# Restart the WinRM service
Restart-Service -Force WinRM

# Enable CredSSP authentication
# Use CredSSP for Win11 to connect to localhost
Enable-WSManCredSSP -Role Server

To verify WinRM with HTTPS is enabled, run the following command in PowerShell:

Get-WSManInstance WinRM/Config/Listener -Enumerate | Where-Object { $_.transport -eq "HTTPS" }

To enable file and print sharing, run the following command in PowerShell:

# Enable File and Print sharing, via PowerShell
# This is for windows deployment step
Get-NetFirewallRule -DisplayGroup 'File and Printer Sharing' `
    | Set-NetFirewallRule -Profile Any -Enabled true

To verify file and print sharing is enabled, run the following command in PowerShell:

Get-NetFirewallRule -DisplayGroup "File And Printer Sharing" | select DisplayName, Enabled

Complete

This procedure is now complete. Your file and printing sharing is enabled.