Skip to content

Commit

Permalink
1.1.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jayrodksmith authored Mar 21, 2024
1 parent 788b981 commit 5815568
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 28 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## [Unreleased]

# [1.1.0] - 21-03-2024

### Added

- More Verbose messages

### Changed

- Will no longer try write values to Ninja if fields are not acessible

### Deprecated

### Removed

### Fixed


# [1.0.9] - 21-03-2024

### Added
Expand Down
2 changes: 1 addition & 1 deletion EasyWarrantyCheck.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'EasyWarrantyCheck.psm1'

# Version number of this module.
ModuleVersion = '1.0.9'
ModuleVersion = '1.1.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
1 change: 1 addition & 0 deletions Private/Helpers/Get-SeleniumModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function Get-SeleniumModule {
Get-SelniumModule
#>
# Temporarily set verbose preference to 'SilentlyContinue'
try {
Set-ExecutionPolicy Bypass -scope Process -Force -ErrorAction SilentlyContinue | Out-Null
}catch{
Expand Down
8 changes: 4 additions & 4 deletions Private/Helpers/Get-SeleniumModule4.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ function Get-SeleniumModule4 {
}catch{

}
Import-Module PowerShellGet
$seleniumModule = Get-Module -Name Selenium -ListAvailable
Import-Module PowerShellGet -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
$seleniumModule = Get-Module -Name Selenium -ListAvailable -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
if (-not $seleniumModule) {
Get-PackageProvider -Name "nuGet" -ForceBootstrap | Out-Null
Install-Module -Name Selenium -AllowPrerelease
Install-Module -Name Selenium -AllowPrerelease -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
}
Import-Module Selenium -Force
Import-Module Selenium -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
}
2 changes: 1 addition & 1 deletion Private/Helpers/Start-SeleniumModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Start-SeleniumModule {
Get-RunAsUserModule
Import-Module -Name RunAsUser -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
$scriptblock = {
Import-Module Selenium
Import-Module Selenium -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
$WebDriverPath = "C:\temp\EasyWarrantyCheck\WebDrivers"
$EdgeService = [OpenQA.Selenium.Edge.EdgeDriverService]::CreateDefaultService($WebDriverPath, 'msedgedriver.exe')
$EdgeService.HideCommandPromptWindow = $true
Expand Down
4 changes: 2 additions & 2 deletions Private/Helpers/Stop-SeleniumModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ function Stop-SeleniumModule {

}
}
Remove-Module Selenium -Force -ErrorAction SilentlyContinue -Verbose:$false | Out-null
Remove-Module Selenium -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
}
if($WebDriver -eq "Chrome"){
$driver.quit()
Remove-Module Selenium -Force -ErrorAction SilentlyContinue -Verbose:$false | Out-null
Remove-Module Selenium -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
}
}
26 changes: 18 additions & 8 deletions Private/RMM/Get-WarrantyNinjaRMM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,41 @@ function Get-WarrantyNinjaRMM {
[Parameter(Mandatory = $false)]
[Switch]$Display
)
# Test if fields exist
# Import Ninja Powershell Module
Write-Verbose "Importing Ninja Powershell module"
Import-Module NJCliPSh -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
# Test if fields exist, if not mark them false to prevent trying to store into Ninja
$testninjawarrantystart = Ninja-Property-Get $ninjawarrantystart 2>&1
if ($testninjawarrantystart -match "Unable to find the specified field" ){
Write-Host "Unable to access warrantystart field in ninja"
Write-Host "Unable to access $ninjawarrantystart field in ninja"
Write-Host "Check permissions of field and that it exists"
Set-Variable ninjawarrantystart -Value $false -Scope Global -option ReadOnly -Force
}
$testninjawarrantystatus = Ninja-Property-Get $ninjawarrantystatus 2>&1
if ($testninjawarrantystatus -match "Unable to find the specified field" ){
Write-Host "Unable to access warrantystatus field in ninja"
Write-Host "Unable to access $ninjawarrantystatus field in ninja"
Write-Host "Check permissions of field and that it exists"
Set-Variable ninjawarrantystatus -Value $false -Scope Global -option ReadOnly -Force
}
$testninjawarrantyexpiry = Ninja-Property-Get $ninjawarrantyexpiry 2>&1
if ($testninjawarrantyexpiry -match "Unable to find the specified field" ){
Write-Host "Unable to access warrantyexpiry field in ninja"
Write-Host "Unable to access $ninjawarrantyexpiry field in ninja"
Write-Host "Check permissions of field and that it exists"
Set-Variable ninjawarrantyexpiry -Value $false -Scope Global -option ReadOnly -Force
}
$testninjainvoicenumber = Ninja-Property-Get $ninjainvoicenumber 2>&1
if ($testninjainvoicenumber -match "Unable to find the specified field" ){
Write-Host "Unable to access invoicenumber field in ninja"
Write-Host "Unable to access $ninjainvoicenumber field in ninja"
Write-Host "Check permissions of field and that it exists"
Set-Variable ninjainvoicenumber -Value $false -Scope Global -option ReadOnly -Force
}
$testninjadeviceage = Ninja-Property-Get $ninjadeviceage 2>&1
if ($testninjadeviceage -match "Unable to find the specified field" ){
Write-Host "Unable to access $ninjadeviceage field in ninja"
Write-Host "Check permissions of field and that it exists"
Set-Variable ninjadeviceage -Value $false -Scope Global -option ReadOnly -Force
}
$ninjawarrantystartvalue = Ninja-Property-Get $ninjawarrantystart
$ninjawarrantystatusvalue = Ninja-Property-Get $ninjawarrantystatus
$ninjawarrantyexpiryvalue = Ninja-Property-Get $ninjawarrantyexpiry
$ninjainvoicenumbervalue = Ninja-Property-Get $ninjainvoicenumber
if ($null -ne $ninjawarrantystatusvalue){
if ($Display){
return $ninjawarrantystatusvalue
Expand Down
15 changes: 7 additions & 8 deletions Private/RMM/Write-WarrantyNinjaRMM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function Write-WarrantyNinjaRMM {
return $errorMessage
}
$WarrantyNinjaRMM = Get-WarrantyNinjaRMM
$calculatedageofdevice = Get-AgeOfDevice
if($WarrantyNinjaRMM -eq $true -and ($ForceUpdate -eq $false)){
# Set Age of device if start date exists
if($ninjadeviceage){
$calculatedageofdevice = Get-AgeOfDevice
if($ninjadeviceage -and $ninjadeviceage -ne $false){
if ($calculatedageofdevice -ne $false){
$Currentdeviceage = Ninja-Property-Get $ninjadeviceage
if($Currentdeviceage -ne $calculatedageofdevice){
Expand Down Expand Up @@ -72,27 +72,26 @@ function Write-WarrantyNinjaRMM {
$NinjaWarrantyObj
}

if($Warrantystartutc){
if($Warrantystartutc -and $Warrantystart -ne $false){
Write-Verbose "Will try write Warranty Start Value : $Warrantystartutc"
Ninja-Property-Set $ninjawarrantystart $Warrantystartutc
}
if($WarrantyExpiryutc){
if($WarrantyExpiryutc -and $WarrantyExpiry -ne $false){
Write-Verbose "Will try write Warranty Expiry Value : $WarrantyExpiryutc"
Ninja-Property-Set $ninjawarrantyexpiry $WarrantyExpiryutc
}
if($WarrantyStatus){
if($WarrantyStatus -and $WarrantyStatus -ne $false){
Write-Verbose "Will try write Warranty Status Value : $WarrantyStatus"
Ninja-Property-Set $ninjawarrantystatus $WarrantyStatus
}
if($Invoicenumber){
if($Invoicenumber -and $Invoicenumber -ne $false){
Write-Verbose "Will try write Warranty Invoice Value : $Invoicenumber"
Ninja-Property-Set $ninjainvoicenumber $Invoicenumber
}

# Set Age of device if start date exists
Write-Verbose "Checking for Device Age details to write to NinjaRMM"
if($ninjadeviceage){
$calculatedageofdevice = Get-AgeOfDevice
if($ninjadeviceage -and $ninjadeviceage -ne $false){
if ($calculatedageofdevice -ne $false){
$Currentdeviceage = Ninja-Property-Get $ninjadeviceage
if($Currentdeviceage -ne $calculatedageofdevice){
Expand Down
5 changes: 1 addition & 4 deletions Public/Get-Warranty.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ function Get-Warranty {

)
# Print Current Version
Write-Host "EasyWarrantyCheck Version : 1.0.9"
# Import Ninja Powershell Module
Write-Host "Importing Ninja Powershell module"
Import-Module NJCliPSh -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -verbose:$false | Out-Null
Write-Host "EasyWarrantyCheck Version : 1.1.0"
# Set localization
$DateFormat = (Get-Culture).DateTimeFormat.ShortDatePattern
$DateFormatGlobal = (Get-Culture).DateTimeFormat.ShortDatePattern
Expand Down

0 comments on commit 5815568

Please sign in to comment.