Skip to content

Commit

Permalink
Merge pull request #846 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.20.1016.1
  • Loading branch information
NikCharlebois authored Oct 16, 2020
2 parents c2ff9d8 + ffc3540 commit 957cdfe
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
run: |
Install-Module Pester -Force
[System.Environment]::SetEnvironmentVariable('M365DSCTelemetryEnabled', $false, [System.EnvironmentVariableTarget]::Machine);
Import-Module './Tests/TestHarness.psm1' -Force;
$MaximumFunctionCount = 9999
try
{
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change log for Microsoft365DSC

## 1.20.1016.1

* Fixed a permissions issue with the
Install-M365DSCDevBranch cmdlet (Issue #699 & #826)
* DEPENDENCIES
* MSCloudLoginAssistant Updated to 1.0.41;
* SharePointPnPPowerShellOnline Updated to 3.26.2010.0;
* MISC
* Improved Error log to include StackTrace for additional
info to help troubleshooting errors.

## 1.20.1014.1

* TeamsVoiceRoute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ function Set-TargetResource
if (('Present' -eq $Ensure) -and ('Absent' -eq $CurrentPolicy.Ensure))
{
Write-Verbose -Message "Creating new Retention Compliance Policy $Name"
$CreationParams.Add("Name", $Identity)
$CreationParams.Add("Name", $Name)
$CreationParams.Remove("Identity") | Out-Null
New-RetentionCompliancePolicy @CreationParams
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions Modules/Microsoft365DSC/Microsoft365DSC.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2020-10-14
# Generated on: 2020-10-16

@{

# Script module or binary module file associated with this manifest.
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.20.1014.1'
ModuleVersion = '1.20.1016.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -93,15 +93,15 @@
},
@{
ModuleName = "MSCloudLoginAssistant"
RequiredVersion = "1.0.40"
RequiredVersion = "1.0.41"
},
@{
ModuleName = "ReverseDSC"
RequiredVersion = "2.0.0.7"
},
@{
ModuleName = "SharePointPnPPowerShellOnline"
RequiredVersion = "3.25.2009.1"
RequiredVersion = "3.26.2010.0"
}
)

Expand Down
44 changes: 24 additions & 20 deletions Modules/Microsoft365DSC/Modules/M365DSCLogEngine.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function New-M365DSCLogEntry
try
{
$VerbosePreference = 'Continue'
Write-Host "$($Global:M365DSCEmojiRedX) Logging a new Error"
Write-Host "$($Global:M365DSCEmojiRedX)"

#region Telemetry
$driftedData = [System.Collections.Generic.Dictionary[[String], [String]]]::new()
Expand All @@ -32,6 +32,7 @@ function New-M365DSCLogEntry
$driftedData.Add("Exception", $Error.Exception.ToString())
$driftedData.Add("CustomMessage", $Message)
$driftedData.Add("Source", $Source)
$driftedData.Add("StackTrace", $Error.ScriptStackTrace)
Add-M365DSCTelemetryEvent -Type "Error" -Data $driftedData
#endregion

Expand All @@ -47,10 +48,13 @@ function New-M365DSCLogEntry
$LogContent += "{" + $Error.CategoryInfo.Category.ToString() + "}`r`n"
$LogContent += $Error.Exception.ToString() + "`r`n"
$LogContent += "`"" + $Message + "`"`r`n"
$LogContent += $Error.ScriptStackTrace + "`r`n"
$LogContent += "`r`n`r`n"

# Write the error content into the log file;
$LogFileName = Join-Path -Path (Get-Location).Path -ChildPath $LogFileName
$LogContent | Out-File $LogFileName -Append
Write-Host "Error Log created at {$LogFileName}" -ForegroundColor Cyan
}
catch
{
Expand Down Expand Up @@ -82,37 +86,37 @@ function Add-M365DSCEvent

$LogName = 'M365DSC'

if ([System.Diagnostics.EventLog]::SourceExists($Source))
{
$sourceLogName = [System.Diagnostics.EventLog]::LogNameFromSourceName($Source, ".")
if ($LogName -ne $sourceLogName)
{
Write-Verbose -Message "[ERROR] Specified source {$Source} already exists on log {$sourceLogName}"
return
}
}
else
try
{
if ([System.Diagnostics.EventLog]::Exists($LogName) -eq $false)
if ([System.Diagnostics.EventLog]::SourceExists($Source))
{
#Create event log
$null = New-EventLog -LogName $LogName -Source $Source
$sourceLogName = [System.Diagnostics.EventLog]::LogNameFromSourceName($Source, ".")
if ($LogName -ne $sourceLogName)
{
Write-Verbose -Message "[ERROR] Specified source {$Source} already exists on log {$sourceLogName}"
return
}
}
else
{
[System.Diagnostics.EventLog]::CreateEventSource($Source, $LogName)
if ([System.Diagnostics.EventLog]::Exists($LogName) -eq $false)
{
#Create event log
$null = New-EventLog -LogName $LogName -Source $Source
}
else
{
[System.Diagnostics.EventLog]::CreateEventSource($Source, $LogName)
}
}
}

try
{
Write-EventLog -LogName $LogName -Source $Source `
-EventID $EventID -Message $Message -EntryType $EntryType
}
catch
{
Write-Verbose -Message $_
Add-M365DSCEvent -Message $_ -EntryType 'Error' `
-EventID 1 -Source $($MyInvocation.MyCommand.Source)
$Message = "Could not write to event log"
New-M365DSCLogEntry -Error $_ -Message $Message -Source "[M365DSCLogEngine]"
}
}
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Modules/M365DSCReverseGUI.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ function Show-M365DSCGUI
catch
{
$Message = "Could not initiate the ReverseDSC Extraction"
New-M365DSCLogEntry -Error $_ -Message $Message_ -Source "[M365DSCReverseGUI]"
New-M365DSCLogEntry -Error $_ -Message $Message -Source "[M365DSCReverseGUI]"
}
})
$panelMenu.Controls.Add($btnExtract);
Expand Down
32 changes: 28 additions & 4 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1385,9 +1385,11 @@ function Install-M365DSCDevBranch
[CmdletBinding()]
param()
#region Download and Extract Dev branch's ZIP
Write-Host "Downloading the Zip package..." -NoNewline
$url = "https://github.com/microsoft/Microsoft365DSC/archive/Dev.zip"
$output = "$($env:Temp)\dev.zip"
$extractPath = $env:Temp + "\O365Dev"
Write-Host "Done" -ForegroundColor Green

Invoke-WebRequest -Uri $url -OutFile $output

Expand All @@ -1399,19 +1401,41 @@ function Install-M365DSCDevBranch
$dependencies = $manifest.RequiredModules
foreach ($dependency in $dependencies)
{
Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -Force -AllowClobber
Import-Module $dependency.ModuleName -Force
Write-Host "Installing {$($dependency.ModuleName)}..." -NoNewLine
$existingModule = Get-Module $dependency.ModuleName -ListAvailable | Where-Object -FilterScript {$_.Version -eq $dependency.RequiredVersion}
if ($null -eq $existingModule)
{
Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -Force -AllowClobber | Out-Null
}
Import-Module $dependency.ModuleName -Force | Out-Null
Write-Host "Done" -ForegroundColor Green
}
#endregion

#region Install M365DSC
Write-Host "Updating the Core Microsoft365DSC module..." -NoNewline
$defaultPath = 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\'
$currentVersionPath = $defaultPath + ([Version]$($manifest.ModuleVersion)).ToString()

Copy-Item "$extractPath\Microsoft365DSC-Dev\Modules\Microsoft365DSC\*" `
-Destination $defaultPath -Recurse -Force

Import-Module ($defaultPath + "Microsoft365DSC.psd1") -Force | Out-Null
$oldModule = Get-Module 'Microsoft365DSC' | Where-Object -FilterScript {$_.ModuleBase -eq $currentVersionPath}
Remove-Module $oldModule -Force | Out-Null
if (Test-Path $currentVersionPath)
{
Remove-Item $currentVersionPath -Recurse -Confirm:$false
try
{
Remove-Item $currentVersionPath -Recurse -Confirm:$false -Force `
-ErrorAction Stop
}
catch
{
Write-Verbose $_
}
}
Copy-Item "$extractPath\Microsoft365DSC-Dev\Modules\Microsoft365DSC" -Destination $currentVersionPath -Recurse -Force
Write-Host "Done" -ForegroundColor Green
#endregion
}

Expand Down

0 comments on commit 957cdfe

Please sign in to comment.