Skip to content

Commit

Permalink
Fix WInRM
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed May 11, 2024
1 parent 915572f commit b51de3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ stages:
buildType: 'current'
artifactName: $(buildArtifactName)
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'
- task: PowerShell@2
name: configureWinRM
displayName: 'Configure WinRM'
inputs:
targetType: 'inline'
script: 'winrm quickconfig -quiet'
pwsh: false
- powershell: |
Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1
Remove-PowerShellModuleFromCI -Name @('SqlServer', 'SQLPS')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,17 @@ Describe 'Prerequisites' {
}
}

Context 'Enable PS Remoting in local subnet' -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
Context 'Test PS Remoting to localhost' -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') {
It 'Should enable PS Remoting' {
Enable-PSRemoting -Force -SkipNetworkProfileCheck -Verbose -ErrorAction 'Stop'
#winrm quickconfig -quiet
#Enable-PSRemoting -Force -SkipNetworkProfileCheck -Verbose -ErrorAction 'Stop'
#Test-WSMan -ComputerName $env:COMPUTERNAME -ErrorAction 'Stop'
#winrm enumerate winrm/config/listener
#winrm enumerate winrm/config/listener | Should -Contain 'Transport = HTTP'
# # allows remote access from public networks from any remote location
# Set-NetFirewallRule -Name 'WINRM-HTTP-In-TCP' -RemoteAddress Any -Verbose -ErrorAction 'Stop'

$result = Invoke-Command -ComputerName (Get-ComputerName) -ScriptBlock { 1 } -ErrorAction 'Stop'
$result = Invoke-Command -ComputerName 'localhost' -ScriptBlock { 1 } -ErrorAction 'Stop'

$result | Should -Be 1
}
Expand Down

0 comments on commit b51de3d

Please sign in to comment.