Skip to content

Commit

Permalink
!deploy v2.36.0 - Closes #252, closes #256, closes #258, closes #263
Browse files Browse the repository at this point in the history
## 2.36.0 - 2020-02-28

* [PR #255](#255) - _Thanks, [@FISHMANPET](https://github.com/FISHMANPET)!_
    * Added support for `[ScriptBlock]` values on the config, allowing you to provide a script to run that will pull in a configuration value (vs embedded the value directly on the config)
* [PR #255](#260) - _Thanks, [@vaskotoo](https://github.com/vaskotoo)!_
    * Added support for an array of Users on `Get-GSGmailMessageList`
* [PR #261](#261) - _Thanks, [@Foggy2](https://github.com/Foggy2)!_
    * Added support for all license types including undocumented ones.
    * Closed out [Issue #252](#252) as well.
* [PR #262](#262) - _Thanks, [@nwls-hermesj](https://github.com/nwls-hermesj)!_
    * Added support for pipeline input of Drive file objects to `Remove-GSDriveFile`.
* [Issue #256](#256)
    * Cleaned up docs on `Send-GSChatMessage`.
* [Issue #258](#258)
    * Removed URL Shortener functions due to Google deprecation.
* [Issue #263](#263)
    * Fixed `[SecureString]` decryption on Unix machines running PowerShell 7
* Miscellaneous
    * Removed the Tasks API functions. Google has not pushed an update to the Tasks .NET SDK in over 2 months, so it is now behind the current release versions of the core Google.Apis assemblies, resulting in failure to import.
  • Loading branch information
scrthq authored Feb 28, 2020
2 parents 988c685 + 63fe309 commit daaae47
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 81 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [PSGSuite - ChangeLog](#psgsuite---changelog)
* [2.36.0 - 2020-02-28](#2360---2020-02-28)
* [2.35.1 - 2019-12-29](#2351---2019-12-29)
* [2.35.0 - 2019-12-29](#2350---2019-12-29)
* [2.34.0 - 2019-11-02](#2340---2019-11-02)
Expand Down Expand Up @@ -106,6 +107,26 @@

# PSGSuite - ChangeLog

## 2.36.0 - 2020-02-28

* [PR #255](https://github.com/scrthq/PSGSuite/pull/255) - _Thanks, [@FISHMANPET](https://github.com/FISHMANPET)!_
* Added support for `[ScriptBlock]` values on the config, allowing you to provide a script to run that will pull in a configuration value (vs embedded the value directly on the config)
* [PR #255](https://github.com/scrthq/PSGSuite/pull/260) - _Thanks, [@vaskotoo](https://github.com/vaskotoo)!_
* Added support for an array of Users on `Get-GSGmailMessageList`
* [PR #261](https://github.com/scrthq/PSGSuite/issues/261) - _Thanks, [@Foggy2](https://github.com/Foggy2)!_
* Added support for all license types including undocumented ones.
* Closed out [Issue #252](https://github.com/scrthq/PSGSuite/issues/252) as well.
* [PR #262](https://github.com/scrthq/PSGSuite/issues/262) - _Thanks, [@nwls-hermesj](https://github.com/nwls-hermesj)!_
* Added support for pipeline input of Drive file objects to `Remove-GSDriveFile`.
* [Issue #256](https://github.com/scrthq/PSGSuite/issues/256)
* Cleaned up docs on `Send-GSChatMessage`.
* [Issue #258](https://github.com/scrthq/PSGSuite/issues/258)
* Removed URL Shortener functions due to Google deprecation.
* [Issue #263](https://github.com/scrthq/PSGSuite/issues/263)
* Fixed `[SecureString]` decryption on Unix machines running PowerShell 7
* Miscellaneous
* Removed the Tasks API functions. Google has not pushed an update to the Tasks .NET SDK in over 2 months, so it is now behind the current release versions of the core Google.Apis assemblies, resulting in failure to import.

## 2.35.1 - 2019-12-29

* [Issue #57](https://github.com/scrthq/PSGSuite/issues/57)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion PSGSuite/Aliases/PSGSuite.Aliases.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'Get-GSOrgUnitList' = 'Get-GSOrganizationalUnit'
'Get-GSOU' = 'Get-GSOrganizationalUnit'
'Get-GSResourceList' = 'Get-GSResource'
'Get-GSShortURLInfo' = 'Get-GSShortURL'
'Get-GSTeamDrive' = 'Get-GSDrive'
'Get-GSTeamDrivesList' = 'Get-GSDrive'
'Get-GSUserASPList' = 'Get-GSUserASP'
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.35.1'
ModuleVersion = '2.36.0'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
45 changes: 33 additions & 12 deletions PSGSuite/Private/Import-GoogleSDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,39 @@ function Import-GoogleSDK {
Write-Verbose "Importing the SDK's for netstandard1.3"
"$lib\netstandard1.3"
}
Get-ChildItem $sdkPath -Filter "*.dll" | Where-Object {$_.Name -notin $refs} | ForEach-Object {
$sdk = $_.Name
try {
Add-Type -Path $_.FullName -ErrorAction Stop
}
catch [System.Reflection.ReflectionTypeLoadException] {
Write-Host "Message: $($_.Exception.Message)"
Write-Host "StackTrace: $($_.Exception.StackTrace)"
Write-Host "LoaderExceptions: $($_.Exception.LoaderExceptions)"
}
catch {
Write-Error "$($sdk): $($_.Exception.Message)"
$dlls = Get-ChildItem $sdkPath -Filter "*.dll"
$googleCore = ($dlls | Where-Object {$_.Name -eq 'Google.Apis.dll'})
$googleCoreVersion = [System.Version]((Get-Item $googleCore.FullName).VersionInfo.FileVersion)
$batches = @(
# Load the non-Google DLLs first...
($dlls | Where-Object {$_.Name -notin $refs -and $_.Name -notmatch '^Google'})
# Then load Google.Apis.dll...
$googleCore
# Then load the rest of the Google DLLs
($dlls | Where-Object {$_.Name -notin $refs -and $_.Name -match '^Google' -and $_.Name -ne 'Google.Apis.dll'})
)
foreach ($batch in $batches) {
$batch | ForEach-Object {
$sdk = $_.Name
try {
$params = @{}
if ($_.Name -match '^Google' -and $_.Name -ne 'Google.Apis.dll' -and ([System.Version]((Get-Item $_.FullName).VersionInfo.FileVersion)) -ge $googleCoreVersion) {
$params['ReferencedAssemblies'] = ($dlls | Where-Object {$_.Name -eq 'Google.Apis.dll'}).FullName
Add-Type -Path $_.FullName @params -ErrorAction Stop
}
elseif ($_.Name -notmatch '^Google' -or $_.Name -eq 'Google.Apis.dll' -or ($_.Name -ne 'Google.Apis.dll' -and ([System.Version]((Get-Item $_.FullName).VersionInfo.FileVersion)) -ge $googleCoreVersion)) {
Add-Type -Path $_.FullName @params -ErrorAction Stop
}
}
catch [System.Reflection.ReflectionTypeLoadException] {
Write-Error "$($sdk): Unable to load assembly!"
Write-Host "Message: $($_.Exception.Message)"
Write-Host "StackTrace: $($_.Exception.StackTrace)"
Write-Host "LoaderExceptions: $($_.Exception.LoaderExceptions)"
}
catch {
Write-Error "$($sdk): $($_.Exception.Message)"
}
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions PSGSuite/Public/Chat/Send-GSChatMessage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ function Send-GSChatMessage {
You can safely store an encrypted dictionary of Webhooks in the PSGSuite Config by passing a hashtable to the `-Webhook` parameter, i.e.:
Set-PSGSuiteConfig -Webhook @{JobReports = 'https://chat.googleapis.com/v1/spaces/xxxxxxxxxx/messages?key=xxxxxxxxxxxxxxxxxx&token=xxxxxxxxxxxxxxxxxx'}
To retrieve a stored Webhook, you can use `Get-GSChatWebhook`, i.e.:
Send-GSChatMessage -Text "Post job report:" -Cards $cards -Webhook (Get-GSChatWebhook JobReports)
.PARAMETER MessageSegment
Any Chat message segment objects created with functions named `Add-GSChat*` passed through the pipeline or added directly to this parameter as values.
Expand All @@ -66,7 +63,7 @@ function Send-GSChatMessage {
If $true, returns the message body.
.EXAMPLE
Send-GSChatMessage -Text "Post job report:" -Cards $cards -Webhook (Get-GSChatWebhook JobReports)
Send-GSChatMessage -Text "Post job report:" -Cards $cards -Webhook JobReports
Sends a simple Chat message using the JobReports webhook
Expand Down
6 changes: 4 additions & 2 deletions PSGSuite/Public/Configuration/Get-PSGSuiteConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ function Get-PSGSuiteConfig {
function Decrypt {
param($String)
if ($String -is [System.Security.SecureString]) {
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto(
[System.Runtime.InteropServices.Marshal]::PtrToStringBSTR(
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR(
$String))
$String
)
)
}
elseif ($String -is [ScriptBlock]) {
$String.InvokeReturnAsIs()
Expand Down
39 changes: 21 additions & 18 deletions PSGSuite/Public/Gmail/New-GSGmailSMIMEInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ function New-GSGmailSMIMEInfo {
[cmdletbinding()]
Param
(
[parameter(Mandatory = $true,ValueFromPipelineByPropertyName = $true)]
[parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[string]
$SendAsEmail,
[parameter(Mandatory = $true)]
[ValidateScript({
if (!(Test-Path $_)) {
throw "Please enter a valid file path."
}
elseif ($_ -notlike "*.pfx" -and $_ -notlike "*.p12") {
throw "Pkcs12 must be a .pfx or .p12 file"
}
else {
$true
}
})]
[ValidateScript( {
if (!(Test-Path $_)) {
throw "Please enter a valid file path."
}
elseif ($_ -notlike "*.pfx" -and $_ -notlike "*.p12") {
throw "Pkcs12 must be a .pfx or .p12 file"
}
else {
$true
}
})]
[string]
$Pkcs12,
[parameter(Mandatory = $false)]
Expand All @@ -53,26 +53,29 @@ function New-GSGmailSMIMEInfo {
[parameter(Mandatory = $false)]
[Switch]
$IsDefault,
[parameter(Mandatory = $true,ValueFromPipelineByPropertyName = $true)]
[Alias("PrimaryEmail","UserKey","Mail")]
[parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[Alias("PrimaryEmail", "UserKey", "Mail")]
[ValidateNotNullOrEmpty()]
[string]
$User
)
Process {
Resolve-Email ([Ref]$User)
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/gmail.settings.basic'
Scope = @(
'https://www.googleapis.com/auth/gmail.settings.basic'
'https://www.googleapis.com/auth/gmail.settings.sharing'
)
ServiceType = 'Google.Apis.Gmail.v1.GmailService'
User = $User
}
$service = New-GoogleService @serviceParams
try {
$body = New-Object 'Google.Apis.Gmail.v1.Data.SmimeInfo'
foreach ($key in $PSBoundParameters.Keys | Where-Object {$body.PSObject.Properties.Name -contains $_}) {
foreach ($key in $PSBoundParameters.Keys | Where-Object { $body.PSObject.Properties.Name -contains $_ }) {
switch ($key) {
EncryptedKeyPassword {
$pw = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password
$pw = (New-Object PSCredential "user", $PSBoundParameters[$key]).GetNetworkCredential().Password
$body.EncryptedKeyPassword = $pw
}
Pkcs12 {
Expand All @@ -86,7 +89,7 @@ function New-GSGmailSMIMEInfo {
}
}
Write-Verbose "Adding new S/MIME of SendAsEmail '$SendAsEmail' for user '$User' using Certificate '$Pkcs12'"
$request = $service.Users.Settings.SendAs.SmimeInfo.Insert($body,$User,$SendAsEmail)
$request = $service.Users.Settings.SendAs.SmimeInfo.Insert($body, $User, $SendAsEmail)
$request.Execute() | Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru
}
catch {
Expand Down
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,22 @@ All other functions are either intact or have an alias included to support backw

[Full CHANGELOG here](https://github.com/scrthq/PSGSuite/blob/master/CHANGELOG.md)

#### 2.34.0 - 2019-11-02

* [Issue #245](https://github.com/scrthq/PSGSuite/issues/245) + [PR #246](https://github.com/scrthq/PSGSuite/pull/246) - _Thank you, [@devblackops](https://github.com/devblackops)!_
* Added: Optional `-CreateMeetEvent` switch parameter to `New-GSCalendarEvent` to create a Google Meet conference and attach it to the calendar event.
#### 2.36.0 - 2020-02-28

* [PR #255](https://github.com/scrthq/PSGSuite/pull/255) - _Thanks, [@FISHMANPET](https://github.com/FISHMANPET)!_
* Added support for `[ScriptBlock]` values on the config, allowing you to provide a script to run that will pull in a configuration value (vs embedded the value directly on the config)
* [PR #255](https://github.com/scrthq/PSGSuite/pull/260) - _Thanks, [@vaskotoo](https://github.com/vaskotoo)!_
* Added support for an array of Users on `Get-GSGmailMessageList`
* [PR #261](https://github.com/scrthq/PSGSuite/issues/261) - _Thanks, [@Foggy2](https://github.com/Foggy2)!_
* Added support for all license types including undocumented ones.
* Closed out [Issue #252](https://github.com/scrthq/PSGSuite/issues/252) as well.
* [PR #262](https://github.com/scrthq/PSGSuite/issues/262) - _Thanks, [@nwls-hermesj](https://github.com/nwls-hermesj)!_
* Added support for pipeline input of Drive file objects to `Remove-GSDriveFile`.
* [Issue #256](https://github.com/scrthq/PSGSuite/issues/256)
* Cleaned up docs on `Send-GSChatMessage`.
* [Issue #258](https://github.com/scrthq/PSGSuite/issues/258)
* Removed URL Shortener functions due to Google deprecation.
* [Issue #263](https://github.com/scrthq/PSGSuite/issues/263)
* Fixed `[SecureString]` decryption on Unix machines running PowerShell 7
* Miscellaneous
* Removed the Tasks API functions. Google has not pushed an update to the Tasks .NET SDK in over 2 months, so it is now behind the current release versions of the core Google.Apis assemblies, resulting in failure to import.
9 changes: 6 additions & 3 deletions ci/AzurePipelinesHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ function Install-NuGetDependencies {
foreach ($search in $AddlSearchString) {
Write-BuildLog "Finding NuGet packages matching SearchString: $search"
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet -Force -Trusted -ForceBootstrap
PackageManagement\Find-Package $search -Source NuGet -AllowPrereleaseVersions:$false -Verbose | Where-Object {$_.Name -in $packagesToInstall.BaseName} | ForEach-Object {
PackageManagement\Find-Package $search -Source NuGet -AllowPrereleaseVersions:$false | Where-Object {$_.Name -in $packagesToInstall.BaseName} | ForEach-Object {
Write-BuildLog "Matched package: $($_.Name)"
$nugHash[$_.Name] = $_
}
}
$webClient = New-Object System.Net.WebClient
foreach ($inst in $packagesToInstall) {
try {
$pkg = if ($nugHash.ContainsKey($inst.BaseName)) {
Expand All @@ -64,7 +65,8 @@ function Install-NuGetDependencies {
$pkgUrl = 'https://www.nuget.org/api/v2/package/'+ ($pkg.TagId.Replace('#','/'))
$i = 0
do {
Invoke-WebRequest -Uri $pkgUrl -OutFile $zipPath
$webClient.DownloadFile($pkgUrl,$zipPath)
#Invoke-WebRequest -Uri $pkgUrl -OutFile $zipPath
$i++
}
until ((Test-Path $zipPath) -or $i -ge 5)
Expand All @@ -87,7 +89,7 @@ function Install-NuGetDependencies {
[System.IO.Path]::Combine($extPath,'lib',$target)
}
if (Test-Path $sourcePath) {
Get-ChildItem $sourcePath -Filter '*.dll' | Copy-Item -Destination $targetPath -Force -Verbose
Get-ChildItem $sourcePath -Filter '*.dll' | Copy-Item -Destination $targetPath -Force
}
else {
Write-BuildError "$($pkg.Name) was not downloaded successfully from NuGet!" -ErrorAction Stop
Expand All @@ -108,6 +110,7 @@ function Install-NuGetDependencies {
}
}
}
$webClient.Dispose()
}
finally {
if (Test-Path $dllStgPath) {
Expand Down
26 changes: 4 additions & 22 deletions ci/NuGetDependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Name": "Google.Apis.dll",
"BaseName": "Google.Apis",
"Target": "Latest",
"LatestVersion": "1.41.1"
"LatestVersion": "1.44.0"
},
{
"Name": "Google.Apis.Admin.DataTransfer.datatransfer_v1.dll",
Expand All @@ -35,12 +35,6 @@
"Target": "Latest",
"LatestVersion": "1.41.1"
},
{
"Name": "Google.Apis.Auth.PlatformServices.dll",
"BaseName": "Google.Apis.Auth.PlatformServices",
"Target": "Latest",
"LatestVersion": "1.41.1"
},
{
"Name": "Google.Apis.Calendar.v3.dll",
"BaseName": "Google.Apis.Calendar.v3",
Expand Down Expand Up @@ -113,12 +107,6 @@
"Target": "Latest",
"LatestVersion": "1.41.1.1715"
},
{
"Name": "Google.Apis.PlatformServices.dll",
"BaseName": "Google.Apis.PlatformServices",
"Target": "Latest",
"LatestVersion": "1.41.1"
},
{
"Name": "Google.Apis.Script.v1.dll",
"BaseName": "Google.Apis.Script.v1",
Expand All @@ -143,22 +131,16 @@
"Target": "Latest",
"LatestVersion": "1.41.1.1713"
},
{
"Name": "Google.Apis.Urlshortener.v1.dll",
"BaseName": "Google.Apis.Urlshortener.v1",
"Target": "Latest",
"LatestVersion": "1.41.1.138"
},
{
"Name": "MimeKit.dll",
"BaseName": "MimeKit",
"Target": "1.10.1.0",
"Target": "Latest",
"LatestVersion": "1.10.1.0"
},
{
"Name": "Newtonsoft.Json.dll",
"BaseName": "Newtonsoft.Json",
"Target": "10.0.3",
"LatestVersion": "10.0.3"
"Target": "Latest",
"LatestVersion": "12.0.3"
}
]
18 changes: 4 additions & 14 deletions ci/UpdateNuGetDependenciesJson.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ($items = Get-ChildItem (Resolve-Path $PSScriptRoot\..\BuildOutput\PSGSuite\*\lib\net45 -ErrorAction SilentlyContinue).Path -Filter '*.dll') {
if ($items = Get-ChildItem (Resolve-Path $PSScriptRoot\..\BuildOutput\PSGSuite\*\lib\net45 -ErrorAction SilentlyContinue).Path -Filter '*.dll' | Where-Object {$_.BaseName -ne 'Google.Apis.Auth.PlatformServices'}) {
$items |
#Where-Object |
Sort-Object BaseName |
Expand All @@ -17,21 +17,11 @@ if ($items = Get-ChildItem (Resolve-Path $PSScriptRoot\..\BuildOutput\PSGSuite\*
@{
N='Target'
E={
if ($_.BaseName -match 'Google') {
'Latest'
if ($_.BaseName -match 'BouncyCastle.Crypto') {
'1.8.1'
}
else {
switch ($_.BaseName) {
'BouncyCastle.Crypto' {
'1.8.1'
}
'MimeKit' {
'1.10.1.0'
}
'Newtonsoft.Json' {
'10.0.3'
}
}
'Latest'
}
}
},
Expand Down

0 comments on commit daaae47

Please sign in to comment.