Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ Fix steps:
$cryptoTarget = "/lib64/libcrypto.so.10"
}

if ( ! (test-path "$publishPath/libssl.so.1.0.0")) {
if ( ! (Test-Path "$publishPath/libssl.so.1.0.0")) {
$null = New-Item -Force -ItemType SymbolicLink -Target $sslTarget -Path "$publishPath/libssl.so.1.0.0" -ErrorAction Stop
}
if ( ! (test-path "$publishPath/libcrypto.so.1.0.0")) {
if ( ! (Test-Path "$publishPath/libcrypto.so.1.0.0")) {
$null = New-Item -Force -ItemType SymbolicLink -Target $cryptoTarget -Path "$publishPath/libcrypto.so.1.0.0" -ErrorAction Stop
}
}
Expand Down Expand Up @@ -888,7 +888,7 @@ function Get-PesterTag {
$alltags = @{}
$warnings = @()

get-childitem -Recurse $testbase -File | Where-Object {$_.name -match "tests.ps1"}| ForEach-Object {
Get-ChildItem -Recurse $testbase -File | Where-Object {$_.name -match "tests.ps1"}| ForEach-Object {
$fullname = $_.fullname
$tok = $err = $null
$ast = [System.Management.Automation.Language.Parser]::ParseFile($FullName, [ref]$tok,[ref]$err)
Expand Down Expand Up @@ -1276,7 +1276,7 @@ function Start-PSPester {
break
}

$count = ($lines | measure-object).Count
$count = ($lines | Measure-Object).Count
if ($count -eq 0)
{
Start-Sleep -Seconds 1
Expand Down Expand Up @@ -1469,7 +1469,7 @@ function Test-XUnitTestResults
throw "Cannot convert $TestResultsFile to xml : $($_.message)"
}

$failedTests = $results.assemblies.assembly.collection | Where-Object failed -gt 0
$failedTests = $results.assemblies.assembly.collection | Where-Object failed -GT 0

if(-not $failedTests)
{
Expand Down Expand Up @@ -1521,7 +1521,7 @@ function Test-PSPesterResults
throw "Test result file '$testResultsFile' not found for $TestArea."
}

$x = [xml](Get-Content -raw $testResultsFile)
$x = [xml](Get-Content -Raw $testResultsFile)
if ([int]$x.'test-results'.failures -gt 0)
{
Write-Log -Error "TEST FAILURES"
Expand Down Expand Up @@ -2093,7 +2093,7 @@ function script:Use-MSBuild {
# msbuild v14 and msbuild v4 behaviors are different for XAML generation
$frameworkMsBuildLocation = "${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319\msbuild"

$msbuild = get-command msbuild -ErrorAction Ignore
$msbuild = Get-Command msbuild -ErrorAction Ignore
if ($msbuild) {
# all good, nothing to do
return
Expand Down Expand Up @@ -2873,17 +2873,17 @@ assembly
PROCESS {
#### MAIN ####
foreach ( $log in $Logfile ) {
foreach ( $logpath in (resolve-path $log).path ) {
write-progress "converting file $logpath"
foreach ( $logpath in (Resolve-Path $log).path ) {
Write-Progress "converting file $logpath"
if ( ! $logpath) { throw "Cannot resolve $Logfile" }
$x = [xml](get-content -raw -readcount 0 $logpath)
$x = [xml](Get-Content -Raw -ReadCount 0 $logpath)

if ( $x.psobject.properties['test-results'] ) {
$Logs += convert-pesterlog $x $logpath -includeempty:$includeempty
} elseif ( $x.psobject.properties['assemblies'] ) {
$Logs += convert-xunitlog $x $logpath -includeEmpty:$includeEmpty
} else {
write-error "Cannot determine log type"
Write-Error "Cannot determine log type"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions demos/Apache/apache-demo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ Write-Host -Foreground Blue "Get installed Apache Modules like *proxy* and Sort
Get-ApacheModule | Where-Object {$_.ModuleName -like "*proxy*"} | Sort-Object ModuleName | Out-Host

#Graceful restart of Apache
Write-host -Foreground Blue "Restart Apache Server gracefully"
Write-Host -Foreground Blue "Restart Apache Server gracefully"
Restart-ApacheHTTPServer -Graceful | Out-Host

#Enumerate current virtual hosts (web sites)
Write-Host -Foreground Blue "Enumerate configured Apache Virtual Hosts"
Get-ApacheVHost |out-host
Get-ApacheVHost |Out-Host

#Add a new virtual host
Write-Host -Foreground Yellow "Create a new Apache Virtual Host"
New-ApacheVHost -ServerName "mytestserver" -DocumentRoot /var/www/html/mytestserver -VirtualHostIPAddress * -VirtualHostPort 8090 | Out-Host

#Enumerate new set of virtual hosts
Write-Host -Foreground Blue "Enumerate Apache Virtual Hosts Again"
Get-ApacheVHost |out-host
Get-ApacheVHost |Out-Host

#Cleanup
Write-Host -Foreground Blue "Remove demo virtual host"
Expand Down
4 changes: 2 additions & 2 deletions demos/Docker-PowerShell/Docker-PowerShell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Run-ContainerImage hello-world # Linux
cls

# List all containers that have exited
Get-Container | Where-Object State -eq "exited"
Get-Container | Where-Object State -EQ "exited"

# That found the right one, so go ahead and remove it
Get-Container | Where-Object State -eq "exited" | Remove-Container
Get-Container | Where-Object State -EQ "exited" | Remove-Container

# Now remove the container image
Remove-ContainerImage hello-world
Expand Down
2 changes: 1 addition & 1 deletion demos/SystemD/SystemD/SystemD.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Function Get-SystemDJournal {
$Result = & $sudocmd $cmd $journalctlParameters -o json --no-pager
Try
{
$JSONResult = $Result|ConvertFrom-JSON
$JSONResult = $Result|ConvertFrom-Json
$JSONResult
}
Catch
Expand Down
6 changes: 3 additions & 3 deletions demos/SystemD/journalctl-demo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Import-Module $PSScriptRoot/SystemD/SystemD.psm1

#list recent journal events
Write-host -Foreground Blue "Get recent SystemD journal messages"
Write-Host -Foreground Blue "Get recent SystemD journal messages"
Get-SystemDJournal -args "-xe" |Out-Host

#Drill into SystemD unit messages
Write-host -Foreground Blue "Get recent SystemD journal messages for services and return Unit, Message"
Get-SystemDJournal -args "-xe" | Where-Object {$_._SYSTEMD_UNIT -like "*.service"} | Format-Table _SYSTEMD_UNIT, MESSAGE | Select-Object -first 10 | Out-Host
Write-Host -Foreground Blue "Get recent SystemD journal messages for services and return Unit, Message"
Get-SystemDJournal -args "-xe" | Where-Object {$_._SYSTEMD_UNIT -like "*.service"} | Format-Table _SYSTEMD_UNIT, MESSAGE | Select-Object -First 10 | Out-Host
2 changes: 1 addition & 1 deletion demos/python/class1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
# picking up the Python script from the same directory
#

& $PSScriptRoot/class1.py | ConvertFrom-JSON
& $PSScriptRoot/class1.py | ConvertFrom-Json

4 changes: 2 additions & 2 deletions demos/python/demo_script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $data
@"
#!/usr/bin/python3
print('Hi!')
"@ | out-file -encoding ascii hi
"@ | Out-File -Encoding ascii hi

# Make it executable
chmod +x hi
Expand All @@ -35,7 +35,7 @@ cat class1.py
./class1.py

# Capture the data as structured objects (arrays and hashtables)
$data = ./class1.py | ConvertFrom-JSON
$data = ./class1.py | ConvertFrom-Json

# look at the first element of the returned array
$data[0]
Expand Down
38 changes: 19 additions & 19 deletions src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,35 @@ function Enable-WSManTrace
{

# winrm
"{04c6e16d-b99f-4a3a-9b3e-b8325bbc781e} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii
"{04c6e16d-b99f-4a3a-9b3e-b8325bbc781e} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii

# winrsmgr
"{c0a36be8-a515-4cfa-b2b6-2676366efff7} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{c0a36be8-a515-4cfa-b2b6-2676366efff7} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

# WinrsExe
"{f1cab2c0-8beb-4fa2-90e1-8f17e0acdd5d} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{f1cab2c0-8beb-4fa2-90e1-8f17e0acdd5d} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

# WinrsCmd
"{03992646-3dfe-4477-80e3-85936ace7abb} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{03992646-3dfe-4477-80e3-85936ace7abb} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

# IPMIPrv
"{651d672b-e11f-41b7-add3-c2f6a4023672} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{651d672b-e11f-41b7-add3-c2f6a4023672} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

#IpmiDrv
"{D5C6A3E9-FA9C-434e-9653-165B4FC869E4} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{D5C6A3E9-FA9C-434e-9653-165B4FC869E4} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

# WSManProvHost
"{6e1b64d7-d3be-4651-90fb-3583af89d7f1} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{6e1b64d7-d3be-4651-90fb-3583af89d7f1} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

# Event Forwarding
"{6FCDF39A-EF67-483D-A661-76D715C6B008} 0xffffffff 0xff" | out-file $script:wsmprovfile -encoding ascii -append
"{6FCDF39A-EF67-483D-A661-76D715C6B008} 0xffffffff 0xff" | Out-File $script:wsmprovfile -Encoding ascii -Append

Start-Trace -SessionName $script:wsmsession -ETS -OutputFilePath $script:wsmanlogfile -Format bincirc -MinBuffers 16 -MaxBuffers 256 -BufferSizeInKb 64 -MaxLogFileSizeInMB 256 -ProviderFilePath $script:wsmprovfile
Start-Trace -SessionName $script:wsmsession -ETS -OutputFilePath $script:wsmanlogfile -Format bincirc -MinBuffers 16 -MaxBuffers 256 -BufferSizeInKB 64 -MaxLogFileSizeInMB 256 -ProviderFilePath $script:wsmprovfile
}

function Disable-WSManTrace
{
Stop-Trace $script:wsmsession -ets
Stop-Trace $script:wsmsession -ETS
}

function Enable-PSWSManCombinedTrace
Expand All @@ -177,27 +177,27 @@ function Enable-PSWSManCombinedTrace
$logfile = $PSHOME + "\\Traces\\PSTrace.etl"
}

"Microsoft-Windows-PowerShell 0 5" | out-file $provfile -encoding ascii
"Microsoft-Windows-WinRM 0 5" | out-file $provfile -encoding ascii -append
"Microsoft-Windows-PowerShell 0 5" | Out-File $provfile -Encoding ascii
"Microsoft-Windows-WinRM 0 5" | Out-File $provfile -Encoding ascii -Append

if (!(Test-Path $PSHOME\Traces))
{
New-Item -ItemType Directory -Force $PSHOME\Traces | out-null
New-Item -ItemType Directory -Force $PSHOME\Traces | Out-Null
}

if (Test-Path $logfile)
{
Remove-Item -Force $logfile | out-null
Remove-Item -Force $logfile | Out-Null
}

Start-Trace -SessionName $script:pssession -OutputFilePath $logfile -ProviderFilePath $provfile -ets
Start-Trace -SessionName $script:pssession -OutputFilePath $logfile -ProviderFilePath $provfile -ETS

remove-item $provfile -Force -ea 0
Remove-Item $provfile -Force -ea 0
}

function Disable-PSWSManCombinedTrace
{
Stop-Trace -SessionName $script:pssession -ets
Stop-Trace -SessionName $script:pssession -ETS
}

function Set-LogProperties
Expand All @@ -220,7 +220,7 @@ function Set-LogProperties
$retention = $LogDetails.Retention.ToString()
$autobackup = $LogDetails.AutoBackup.ToString()
$maxLogSize = $LogDetails.MaxLogSize.ToString()
$osVersion = [Version] (Get-Ciminstance Win32_OperatingSystem).Version
$osVersion = [Version] (Get-CimInstance Win32_OperatingSystem).Version

if (($LogDetails.Type -eq "Analytic") -or ($LogDetails.Type -eq "Debug"))
{
Expand Down Expand Up @@ -347,7 +347,7 @@ function Disable-PSTrace
}
}
}
add-type @"
Add-Type @"
using System;

namespace Microsoft.PowerShell.Diagnostics
Expand Down
4 changes: 2 additions & 2 deletions src/powershell-native/Install-PowerShellRemoting.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function Install-PluginEndpoint {

try
{
Write-Host "`nGet-PSSessionConfiguration $pluginEndpointName" -foregroundcolor "green"
Write-Host "`nGet-PSSessionConfiguration $pluginEndpointName" -ForegroundColor "green"
Get-PSSessionConfiguration $pluginEndpointName -ErrorAction Stop
}
catch [Microsoft.PowerShell.Commands.WriteErrorException]
Expand All @@ -227,6 +227,6 @@ function Install-PluginEndpoint {
Install-PluginEndpoint -Force $Force
Install-PluginEndpoint -Force $Force -VersionIndependent

Write-Host "Restarting WinRM to ensure that the plugin configuration change takes effect.`nThis is required for WinRM running on Windows SKUs prior to Windows 10." -foregroundcolor Magenta
Write-Host "Restarting WinRM to ensure that the plugin configuration change takes effect.`nThis is required for WinRM running on Windows SKUs prior to Windows 10." -ForegroundColor Magenta
Restart-Service winrm

4 changes: 2 additions & 2 deletions test/SSHRemoting/SSHRemoting.Basic.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Describe "SSHRemoting Basic Tests" -tags CI {
Context "New-PSSession Tests" {

AfterEach {
if ($script:session -ne $null) { Remove-PSSession -session $script:session }
if ($script:sessions -ne $null) { Remove-PSSession -session $script:sessions }
if ($script:session -ne $null) { Remove-PSSession -Session $script:session }
if ($script:sessions -ne $null) { Remove-PSSession -Session $script:sessions }
}

It "Verifies new connection with implicit current User" {
Expand Down
18 changes: 9 additions & 9 deletions test/common/markdown/markdown-link.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Describe "Verify Markdown Links" {
}

# Cleanup jobs for reliability
get-job | remove-job -force
Get-Job | Remove-Job -Force
}

AfterAll {
# Cleanup jobs to leave the process the same
get-job | remove-job -force
Get-Job | Remove-Job -Force
}

$groups = Get-ChildItem -Path "$PSScriptRoot\..\..\..\*.md" -Recurse | Where-Object {$_.DirectoryName -notlike '*node_modules*'} | Group-Object -Property directory
Expand All @@ -31,7 +31,7 @@ Describe "Verify Markdown Links" {
# start all link verification in parallel
Foreach($group in $groups)
{
Write-Verbose -verbose "starting jobs for $($group.Name) ..."
Write-Verbose -Verbose "starting jobs for $($group.Name) ..."
$job = Start-ThreadJob {
param([object] $group)
foreach($file in $group.Group)
Expand All @@ -46,13 +46,13 @@ Describe "Verify Markdown Links" {
$jobs.add($group.name,$job)
}

Write-Verbose -verbose "Getting results ..."
Write-Verbose -Verbose "Getting results ..."
# Get the results and verify
foreach($key in $jobs.keys)
{
$job = $jobs.$key
$results = Receive-Job -Job $job -Wait
Remove-job -job $Job
Remove-Job -Job $Job
foreach($jobResult in $results)
{
$file = $jobResult.file
Expand Down Expand Up @@ -85,14 +85,14 @@ Describe "Verify Markdown Links" {

if($passes)
{
it "<url> should work" -TestCases $passes {
It "<url> should work" -TestCases $passes {
noop
}
}

if($trueFailures)
{
it "<url> should work" -TestCases $trueFailures {
It "<url> should work" -TestCases $trueFailures {
param($url)

# there could be multiple reasons why a failure is ok
Expand All @@ -111,7 +111,7 @@ Describe "Verify Markdown Links" {
# If invoke-WebRequest can handle the URL, re-verify, with 6 retries
try
{
$null = Invoke-WebRequest -uri $url -RetryIntervalSec 10 -MaximumRetryCount 6
$null = Invoke-WebRequest -Uri $url -RetryIntervalSec 10 -MaximumRetryCount 6
}
catch [Microsoft.PowerShell.Commands.HttpResponseException]
{
Expand All @@ -128,7 +128,7 @@ Describe "Verify Markdown Links" {

if($verifyFailures)
{
it "<url> should work" -TestCases $verifyFailures -Pending {
It "<url> should work" -TestCases $verifyFailures -Pending {
}
}

Expand Down
Loading