diff --git a/.build/CommandletShortNames.yaml b/.build/CommandletShortNames.yaml index 1fbf6fb..f6e4e69 100644 --- a/.build/CommandletShortNames.yaml +++ b/.build/CommandletShortNames.yaml @@ -1,98 +1,134 @@ -Connect-NinjaOne: NinjaOne -Find-NinjaOneDevices: Devices -Get-NinjaOneActivities: Activities -Get-NinjaOneAlerts: Alerts -Get-NinjaOneAntiVirusStatus: AntiVirus Status Query -Get-NinjaOneAntiVirusThreats: AntiVirus Threats Query -Get-NinjaOneAttachment: Attachment -Get-NinjaOneBackupJobs: Backup Jobs -Get-NinjaOneBackupUsage: Backup Usage Query -Get-NinjaOneComputerSystems: Computer Systems Query -Get-NinjaOneContacts: Contacts -Get-NinjaOneCustomFields: Custom Fields Query -Get-NinjaOneDeviceCustomFields: Device Custom Fields -Get-NinjaOneDeviceDashboardURL: Device Dashboard URL -Get-NinjaOneDeviceDisks: Device Disks -Get-NinjaOneDeviceHealth: Device Health Query -Get-NinjaOneDeviceLastLoggedOnUser: Device Last Logged On User -Get-NinjaOneDeviceNetworkInterfaces: Device Network Interfaces -Get-NinjaOneDeviceOSPatches: Device OS Patches -Get-NinjaOneDeviceOSPatchInstalls: Device OS Patch Installs -Get-NinjaOneDevicePolicyOverrides: Device Policy Overrides -Get-NinjaOneDeviceProcessors: Device Processors -Get-NinjaOneDevices: Devices -Get-NinjaOneDeviceScriptingOptions: Device Scripting Options -Get-NinjaOneDeviceSoftwarePatches: Device Software Patches -Get-NinjaOneDeviceSoftwarePatchInstalls: Device Software Patch Installs -Get-NinjaOneDeviceVolumes: Device Volumes -Get-NinjaOneDeviceWindowsServices: Device Windows Services -Get-NinjaOneDisks: Disks Query -Get-NinjaOneDocumentTemplates: Document Template -Get-NinjaOneGroupMembers: Group Members -Get-NinjaOneGroups: Groups -Get-NinjaOneInstaller: Installer -Get-NinjaOneJobs: Jobs -Get-NinjaOneLocationBackupUsage: Location Backup Usage -Get-NinjaOneLocationCustomFields: Location Custom Fields -Get-NinjaOneLocations: Locations -Get-NinjaOneLoggedOnUsers: Logged On Users Query -Get-NinjaOneNetworkInterfaces: Network Interfaces Query -Get-NinjaOneOperatingSystems: Operating Systems Query -Get-NinjaOneOrganisationCustomFields: Organisation Custom Fields -Get-NinjaOneOrganisationDocuments: Documents -Get-NinjaOneOrganisations: Organisations -Get-NinjaOneOSPatches: OS Patches Query -Get-NinjaOneOSPatchInstalls: OS Patch Installs Query -Get-NinjaOnePolicies: Policies -Get-NinjaOnePolicyOverrides: Policy Overrides Query -Get-NinjaOneProcessors: Processors Query -Get-NinjaOneRAIDControllers: RAID Controllers Query -Get-NinjaOneRAIDDrives: RAID Drives Query -Get-NinjaOneRelatedItems: Related Items -Get-NinjaOneRoles: Device Roles -Get-NinjaOneSoftwareInventory: Software Inventory Query -Get-NinjaOneSoftwarePatches: Software Patches Query -Get-NinjaOneSoftwarePatchInstalls: Software Patch Installs Query -Get-NinjaOneSoftwareProducts: Software Products -Get-NinjaOneTasks: Scheduled Tasks -Get-NinjaOneTicketAttributes: Ticket Attributes -Get-NinjaOneTicketBoards: Ticket Boards -Get-NinjaOneTicketForms: Ticket Forms -Get-NinjaOneTicketLogEntries: Ticket Log Entries -Get-NinjaOneTickets: Tickets -Get-NinjaOneTicketStatuses: Ticket Statuses -Get-NinjaOneUsers: Users -Get-NinjaOneVolumes: Volumes Query -Get-NinjaOneWindowsServices: Windows Services Query -Invoke-NinjaOneDeviceScript: Script or Action -Invoke-NinjaOneRequest: API Request -Invoke-NinjaOneWindowsServiceAction: Windows Service Action -New-NinjaOneDocumentTemplate: Document Template -New-NinjaOneInstaller: Installer -New-NinjaOneLocation: Location -New-NinjaOneOrganisation: Organisation -New-NinjaOneOrganisationDocument: Organisation Documents -New-NinjaOnePolicy: Policy -New-NinjaOneTicket: Ticket -New-NinjaOneTicketComment: Ticket Comment -Remove-NinjaOneDeviceMaintenance: Maintenance -Remove-NinjaOneDocumentTemplate: Document Template -Remove-NinjaOneWebhook: Webhook -Reset-NinjaOneAlert: Alert -Reset-NinjaOneDevicePolicyOverrides: Device Policy Overrides -Restart-NinjaOneDevice: Device -Set-NinjaOneDevice: Device -Set-NinjaOneDeviceApproval: Device Approval -Set-NinjaOneDeviceCustomFields: Device Custom Fields -Set-NinjaOneDeviceMaintenance: Device Maintenance -Set-NinjaOneDocumentTemplate: Document Template -Set-NinjaOneLocation: Location -Set-NinjaOneLocationCustomFields: Location Custom Fields -Set-NinjaOneOrganisation: Organisation -Set-NinjaOneOrganisationCustomFields: Organisation Custom Fields -Set-NinjaOneOrganisationDocument: Organisation Document -Set-NinjaOneOrganisationDocuments: Organisation Documents -Set-NinjaOneOrganisationPolicies: Organisation Policies -Set-NinjaOneTicket: Ticket -Set-NinjaOneWindowsServiceConfiguration: Windows Service Configuration -Update-NinjaOneWebhook: Webhook +Connect-NinjaOne: NinjaOne +Find-NinjaOneDevices: Devices +Get-NinjaOneActivities: Activities +Get-NinjaOneAlerts: Alerts +Get-NinjaOneAntiVirusStatus: AntiVirus Status Query +Get-NinjaOneAntiVirusThreats: AntiVirus Threats Query +Get-NinjaOneAutomations: Automation Scripts +Get-NinjaOneBackupJobs: Backup Jobs +Get-NinjaOneComputerSystems: Computer Systems Query +Get-NinjaOneContacts: Contacts +Get-NinjaOneCustomFields: Custom Fields Query +Get-NinjaOneCustomFieldSignedURLs: Custom Field Signed URLs +Get-NinjaOneCustomFieldsPolicyCondition: Custom Field Policy Condition +Get-NinjaOneCustomFieldsPolicyConditions: Custom Field Policy Conditions +Get-NinjaOneDeviceActivities: Device Activities +Get-NinjaOneDeviceAlerts: Device Alerts +Get-NinjaOneDeviceBackupUsage: Backup Usage Query +Get-NinjaOneDeviceCustomFields: Device Custom Fields +Get-NinjaOneDeviceDashboardURL: Device Dashboard URL +Get-NinjaOneDeviceDisks: Device Disk drives +Get-NinjaOneDeviceHealth: Device Health Query +Get-NinjaOneDeviceJobs: Device Jobs +Get-NinjaOneDeviceLastLoggedOnUser: Device Last Logged On User +Get-NinjaOneDeviceNetworkInterfaces: Device Network Interfaces +Get-NinjaOneDeviceOSPatches: Device OS Patches +Get-NinjaOneDeviceOSPatchInstalls: Device OS Patch Installs +Get-NinjaOneDevicePolicyOverrides: Device Policy Overrides +Get-NinjaOneDeviceProcessors: Device Processors +Get-NinjaOneDevices: Devices +Get-NinjaOneDeviceScriptingOptions: Device Scripting Options +Get-NinjaOneDeviceSoftwareInventory: Device Software Inventory +Get-NinjaOneDeviceSoftwarePatches: Device Software Patches +Get-NinjaOneDeviceSoftwarePatchInstalls: Device Software Patch Installs +Get-NinjaOneDeviceVolumes: Device Volumes +Get-NinjaOneDeviceWindowsServices: Device Windows Services +Get-NinjaOneDisks: Disks Query +Get-NinjaOneDocumentTemplates: Document Template +Get-NinjaOneGroupMembers: Group Members +Get-NinjaOneGroups: Groups +Get-NinjaOneInstaller: Installer +Get-NinjaOneIntegrityCheckJobs: Integrity Check Jobs +Get-NinjaOneJobs: Jobs +Get-NinjaOneKnowledgeBaseArticle: Knowledge Base Article +Get-NinjaOneKnowledgeBaseFolders: Knowledge Base Folders +Get-NinjaOneLocationCustomFields: Location Custom Fields +Get-NinjaOneLocations: Locations +Get-NinjaOneLoggedOnUsers: Logged On Users Query +Get-NinjaOneNetworkInterfaces: Network Interfaces Query +Get-NinjaOneNotificationChannels: Notification Channels +Get-NinjaOneOperatingSystems: Operating Systems Query +Get-NinjaOneOrganisationCustomFields: Organisation Custom Fields +Get-NinjaOneOrganisationDocuments: Organisation Documents +Get-NinjaOneOrganisationDocumentSignedURLs: Organisation Document Signed URLs +Get-NinjaOneOrganisationInformation: Organisation Information +Get-NinjaOneOrganisationKnowledgeBaseArticles: Organisation Knowledge Base Articles +Get-NinjaOneOrganisationLocationBackupUsage: Location Backup Usage +Get-NinjaOneOrganisationLocations: Organisation Locations +Get-NinjaOneOrganisationLocationsBackupUsage: Organisation Locations Backup Usage +Get-NinjaOneOrganisations: Organisations +Get-NinjaOneOrganisationUsers: Organisation Users +Get-NinjaOneOSPatches: OS Patches Query +Get-NinjaOneOSPatchInstalls: OS Patch Installs Query +Get-NinjaOnePolicies: Policies +Get-NinjaOnePolicyOverrides: Policy Overrides Query +Get-NinjaOneProcessors: Processors Query +Get-NinjaOneRAIDControllers: RAID Controllers Query +Get-NinjaOneRAIDDrives: RAID Drives Query +Get-NinjaOneRelatedItemAttachment: Related Item Attachment +Get-NinjaOneRelatedItemAttachmentSignedURLs: Related Item Attachment Signed URLs +Get-NinjaOneRelatedItems: Related Items +Get-NinjaOneRoles: Device Roles +Get-NinjaOneSoftwareInventory: Software Inventory Query +Get-NinjaOneSoftwarePatches: Software Patches Query +Get-NinjaOneSoftwarePatchInstalls: Software Patch Installs Query +Get-NinjaOneSoftwareProducts: Software Products +Get-NinjaOneTasks: Scheduled Tasks +Get-NinjaOneTicketAttributes: Ticket Attributes +Get-NinjaOneTicketBoards: Ticket Boards +Get-NinjaOneTicketForms: Ticket Forms +Get-NinjaOneTicketingUsers: Ticketing Users +Get-NinjaOneTicketLogEntries: Ticket Log Entries +Get-NinjaOneTickets: Tickets +Get-NinjaOneTicketStatuses: Ticket Statuses +Get-NinjaOneUsers: Users +Get-NinjaOneVolumes: Volumes Query +Get-NinjaOneWindowsEventPolicyCondition: Windows Event Policy Condition +Get-NinjaOneWindowsServices: Windows Services Query +Invoke-NinjaOneDeviceScript: Script or Action +Invoke-NinjaOneRequest: API Request +Invoke-NinjaOneWindowsServiceAction: Windows Service Action +New-NinjaOneAttachmentRelation: Attachment Relation +New-NinjaOneCustomFieldObject: Custom Field Object Helper +New-NinjaOneCustomFieldsPolicyCondition: Custom Fields Policy Condition +New-NinjaOneDocumentTemplate: Document Template +New-NinjaOneDocumentTemplateFieldObject: Document Template Field Object Helper +New-NinjaOneEntityRelation: Entity Relation +New-NinjaOneEntityRelationObject: Entity Relation Object Helper +New-NinjaOneEntityRelations: Entity Relations +New-NinjaOneInstaller: Installer +New-NinjaOneIntegrityCheckJob: Integrity Check Job +New-NinjaOneLocation: Location +New-NinjaOneOrganisation: Organisation +New-NinjaOneOrganisationDocument: Organisation Documents +New-NinjaOneOrganisationDocuments: Organisation Documents +New-NinjaOnePolicy: Policy +New-NinjaOneSecureRelation: Secure Value Relation +New-NinjaOneTicket: Ticket +New-NinjaOneTicketComment: Ticket Comment +New-NinjaOneWindowsEventPolicyCondition: Windows Event Policy Condition +Remove-NinjaOneDeviceMaintenance: Maintenance +Remove-NinjaOneDocumentTemplate: Document Template +Remove-NinjaOneOrganisationDocument: Organisation Document +Remove-NinjaOnePolicyCondition: Policy Condition +Remove-NinjaOneRelatedItem: Related Item +Remove-NinjaOneRelatedItems: Related Items +Remove-NinjaOneWebhook: Webhook +Reset-NinjaOneAlert: Alert +Reset-NinjaOneDevicePolicyOverrides: Device Policy Overrides +Restart-NinjaOneDevice: Device +Set-NinjaOneDevice: Device +Set-NinjaOneDeviceApproval: Device Approval +Set-NinjaOneDeviceCustomFields: Device Custom Fields +Set-NinjaOneDeviceMaintenance: Device Maintenance +Set-NinjaOneDocumentTemplate: Document Template +Set-NinjaOneLocation: Location +Set-NinjaOneLocationCustomFields: Location Custom Fields +Set-NinjaOneOrganisation: Organisation +Set-NinjaOneOrganisationCustomFields: Organisation Custom Fields +Set-NinjaOneOrganisationDocument: Organisation Document +Set-NinjaOneOrganisationDocuments: Organisation Documents +Set-NinjaOneOrganisationPolicies: Organisation Policies +Set-NinjaOneTicket: Ticket +Set-NinjaOneWindowsServiceConfiguration: Windows Service Configuration +Update-NinjaOneWebhook: Webhook diff --git a/CHANGELOG.md b/CHANGELOG.md index 8db0c57..cfb9045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ Please note that backwards compatibility breaks are prefixed with `{"BC"}` (short for Breaking Change). -## 2024-07-26 - Version 2.0.0-RC5 +## 2024-07-28 - Version 2.0.0-RC6 + +* Fix double declaration of `Get-NinjaOneOrganisationInformation` (once as an alias and once as a new wrapper commandlet!) +* Fix incorrect output type on `New-NinjaOneCustomFieldsObject`. +* Fix incorrect output type on `New-NinjaOneDocumentTemplateObject`. +* Fix incorrect parameter alias on `policyId` param for Windows Event and Custom Field commandlets. +* Fix incorrect parameter alias on `deviceId` param for Integrity Check Job commandlet. + +## 2024-07-28 - Version 2.0.0-RC5 * Add new commandlets: * `Get-NinjaOneAutomations` diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index cb9f958..3fcbbc3 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -1,9 +1,8 @@ @{ - Pester = '5.*' - PlatyPS = '0.14.2' - PSScriptAnalyzer = '1.*' - 'Alt3.Docusaurus.PowerShell' = '1.0.34' - YAYAML = '0.2.1' - Metadata = '1.*' - ModuleBuilder = '3.*' + Pester = '5.*' + PlatyPS = '0.14.2' + PSScriptAnalyzer = '1.*' + YAYAML = '0.2.1' + Metadata = '1.*' + ModuleBuilder = '3.*' } \ No newline at end of file diff --git a/Source/Initialisation.ps1 b/Source/Initialisation.ps1 index 5c1c6af..924a678 100644 --- a/Source/Initialisation.ps1 +++ b/Source/Initialisation.ps1 @@ -1,37 +1,37 @@ -[int32]$Script:NRAPIDefaultPageSize = 2000 -[Hashtable]$Script:NRAPIInstances = @{ - 'eu' = 'https://eu.ninjarmm.com' - 'oc' = 'https://oc.ninjarmm.com' - 'us' = 'https://app.ninjarmm.com' - 'ca' = 'https://ca.ninjarmm.com' - 'us2' = 'https://us2.ninjarmm.com' -} -enum EntityType { - ORGANIZATION = 1 - DOCUMENT = 2 - LOCATION = 3 - NODE = 4 - ATTACHMENT = 5 - TECHNICIAN = 6 - CREDENTIAL = 7 - CHECKLIST = 8 - END_USER = 9 - CONTACT = 10 - KB_DOCUMENT = 11 -} - -enum FilterOperator { - present = 1 - not_present = 2 - is = 3 - is_not = 4 - contains = 5 - not_contains = 6 - contains_any = 7 - contains_none = 8 - greater_than = 9 - less_than = 10 - greater_or_equal_than = 11 - less_or_equal_than = 12 - between = 13 +[int32]$Script:NRAPIDefaultPageSize = 2000 +[Hashtable]$Script:NRAPIInstances = @{ + 'eu' = 'https://eu.ninjarmm.com' + 'oc' = 'https://oc.ninjarmm.com' + 'us' = 'https://app.ninjarmm.com' + 'ca' = 'https://ca.ninjarmm.com' + 'us2' = 'https://us2.ninjarmm.com' +} +enum EntityType { + ORGANIZATION = 1 + DOCUMENT = 2 + LOCATION = 3 + NODE = 4 + ATTACHMENT = 5 + TECHNICIAN = 6 + CREDENTIAL = 7 + CHECKLIST = 8 + END_USER = 9 + CONTACT = 10 + KB_DOCUMENT = 11 +} + +enum FilterOperator { + present = 1 + not_present = 2 + is = 3 + is_not = 4 + contains = 5 + not_contains = 6 + contains_any = 7 + contains_none = 8 + greater_than = 9 + less_than = 10 + greater_or_equal_than = 11 + less_or_equal_than = 12 + between = 13 } \ No newline at end of file diff --git a/Source/NinjaOne.psd1 b/Source/NinjaOne.psd1 index 8fad662..d09cf67 100644 --- a/Source/NinjaOne.psd1 +++ b/Source/NinjaOne.psd1 @@ -255,10 +255,10 @@ IconUri = 'https://pbs.twimg.com/profile_images/1452496768030187521/kIGQii5Y_400x400.jpg' # ReleaseNotes of this module - ReleaseNotes = 'Fix userType parameter on Get-NOUser.' + ReleaseNotes = 'https://github.com/homotechsual/NinjaOne/releases/tag/2.0.0-RC6' # Prerelease string of this module - Prerelease = 'RC5' + Prerelease = 'RC6' # Flag to indicate whether the module requires explicit user acceptance for install/update/save # RequireLicenseAcceptance = $false diff --git a/Source/Public/Backup/New/New-NinjaOneIntegrityCheckJob.ps1 b/Source/Public/Backup/New/New-NinjaOneIntegrityCheckJob.ps1 index f1bc5a7..0225d33 100644 --- a/Source/Public/Backup/New/New-NinjaOneIntegrityCheckJob.ps1 +++ b/Source/Public/Backup/New/New-NinjaOneIntegrityCheckJob.ps1 @@ -22,7 +22,7 @@ function New-NinjaOneIntegrityCheckJob { Param( # The deviceId to create the integrity check job for. [Parameter(Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] - [Alias('id', 'deviceId')] + [Alias('id')] [Int]$deviceId, # The planUid to create the integrity check job for. [Parameter(Mandatory, Position = 1, ValueFromPipelineByPropertyName)] diff --git a/Source/Public/Management/New/New-NinjaOneCustomFieldsPolicyCondition.ps1 b/Source/Public/Management/New/New-NinjaOneCustomFieldsPolicyCondition.ps1 index 53bce84..2490762 100644 --- a/Source/Public/Management/New/New-NinjaOneCustomFieldsPolicyCondition.ps1 +++ b/Source/Public/Management/New/New-NinjaOneCustomFieldsPolicyCondition.ps1 @@ -22,7 +22,7 @@ function New-NinjaOneCustomFieldsPolicyCondition { Param( # The policy id to create the custom fields policy condition for. [Parameter(Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] - [Alias('id', 'policyId')] + [Alias('id')] [Int]$policyId, # An object containing the custom fields policy condition to create. [Parameter(Mandatory, Position = 1, ValueFromPipelineByPropertyName)] diff --git a/Source/Public/Management/New/New-NinjaOneWindowsEventPolicyCondition.ps1 b/Source/Public/Management/New/New-NinjaOneWindowsEventPolicyCondition.ps1 index 0f1e47b..5a0e22a 100644 --- a/Source/Public/Management/New/New-NinjaOneWindowsEventPolicyCondition.ps1 +++ b/Source/Public/Management/New/New-NinjaOneWindowsEventPolicyCondition.ps1 @@ -22,7 +22,7 @@ function New-NinjaOneWindowsEventPolicyCondition { Param( # The policy id to create the windows event policy condition for. [Parameter(Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] - [Alias('id', 'policyId')] + [Alias('id')] [Int]$policyId, # An object containing the windows event policy condition to create. [Parameter(Mandatory, Position = 1, ValueFromPipelineByPropertyName)] diff --git a/Source/Public/Object Helpers/New-NinjaOneCustomFieldObject.ps1 b/Source/Public/Object Helpers/New-NinjaOneCustomFieldObject.ps1 index 6c69d06..efad220 100644 --- a/Source/Public/Object Helpers/New-NinjaOneCustomFieldObject.ps1 +++ b/Source/Public/Object Helpers/New-NinjaOneCustomFieldObject.ps1 @@ -4,13 +4,15 @@ function New-NinjaOneCustomFieldObject { Create a new Custom Field object. .DESCRIPTION Creates a new Custom Field object containing required / specified properties / structure. + .FUNCTIONALITY + Custom Field Object Helper .OUTPUTS - [CustomField] + [Object] A new Custom Field object. #> [CmdletBinding()] - [OutputType([CustomField])] + [OutputType([Object])] [Alias('nnodtfo')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Does not change system state, creates a new object.')] param( diff --git a/Source/Public/Object Helpers/New-NinjaOneDocumentTemplateFieldObject.ps1 b/Source/Public/Object Helpers/New-NinjaOneDocumentTemplateFieldObject.ps1 index 46c674a..1332919 100644 --- a/Source/Public/Object Helpers/New-NinjaOneDocumentTemplateFieldObject.ps1 +++ b/Source/Public/Object Helpers/New-NinjaOneDocumentTemplateFieldObject.ps1 @@ -4,13 +4,15 @@ function New-NinjaOneDocumentTemplateFieldObject { Create a new Document Template Field object. .DESCRIPTION Creates a new Document Template Field object containing required / specified properties / structure. + .FUNCTIONALITY + Document Template Field Object Helper .OUTPUTS - [DocumentTemplateField] + [Object] A new Document Template Field or UI Element object. #> [CmdletBinding()] - [OutputType([DocumentTemplateField])] + [OutputType([Object])] [Alias('nnodtfo')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Does not change system state, creates a new object.')] param( diff --git a/Source/Public/Object Helpers/New-NinjaOneEntityRelationObject.ps1 b/Source/Public/Object Helpers/New-NinjaOneEntityRelationObject.ps1 index 6086f54..72f07ee 100644 --- a/Source/Public/Object Helpers/New-NinjaOneEntityRelationObject.ps1 +++ b/Source/Public/Object Helpers/New-NinjaOneEntityRelationObject.ps1 @@ -4,13 +4,15 @@ function New-NinjaOneEntityRelationObject { Create a new Entity Relation object. .DESCRIPTION Creates a new Entity Relation object containing required / specified properties / structure. + .FUNCTIONALITY + Entity Relation Object Helper .OUTPUTS - [DocumentTemplateField] + [Object] A new Document Template Field or UI Element object. #> [CmdletBinding()] - [OutputType([EntityRelation])] + [OutputType([Object])] [Alias('nnoer')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Does not change system state, creates a new object.')] param( diff --git a/Source/Public/System/Get/Get-NinjaOneOrganisations.ps1 b/Source/Public/System/Get/Get-NinjaOneOrganisations.ps1 index 846eb7a..4cffb6c 100644 --- a/Source/Public/System/Get/Get-NinjaOneOrganisations.ps1 +++ b/Source/Public/System/Get/Get-NinjaOneOrganisations.ps1 @@ -29,7 +29,7 @@ function Get-NinjaOneOrganisations { #> [CmdletBinding( DefaultParameterSetName = 'Multi' )] [OutputType([Object])] - [Alias('gnoo', 'Get-NinjaOneOrganizations', 'Get-NinjaOneOrganisation', 'Get-NinjaOneOrganization', 'gnooi', 'Get-NinjaOneOrganisationInformation', 'Get-NinjaOneOrganizationInformation')] + [Alias('gnoo', 'Get-NinjaOneOrganizations', 'Get-NinjaOneOrganisation', 'Get-NinjaOneOrganization')] [MetadataAttribute( '/v2/organizations', 'get', diff --git a/Source/build.psd1 b/Source/build.psd1 index 73b3a9c..ccdd986 100644 --- a/Source/build.psd1 +++ b/Source/build.psd1 @@ -1,7 +1,7 @@ -@{ - ModuleManifest = 'NinjaOne.psd1' - OutputDirectory = '../output' - PublicFilter = '[Pp]ublic/*/*.ps1' - CopyPaths = @('Binaries') - Prefix = 'Initialisation.ps1' +@{ + ModuleManifest = 'NinjaOne.psd1' + OutputDirectory = '../output' + PublicFilter = '[Pp]ublic/*/*.ps1' + CopyPaths = @('Binaries') + Prefix = 'Initialisation.ps1' } \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 4cc90dd..da1f397 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,8 +1,11 @@ +# requires -Version 7.0 <# .SYNOPSIS Homotechsual portable module build script. #> [CmdletBinding()] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleSyntax', '', Justification = 'Script runs in CI/CD pipelines and is not designed to run on old versions.')] + Param ( [ValidateSet('clean', 'build', 'updateManifest', 'publish', 'updateHelp', 'generateShortNamesMapping', 'push')] [String[]]$TaskNames = ('clean', 'build', 'updateManifest', 'publish', 'updateHelp', 'generateShortNamesMapping', 'push'), @@ -20,6 +23,7 @@ if (-Not(Get-Module -Name 'Install-RequiredModule')) { Install-Script -Name 'Install-RequiredModule' -Force -Scope CurrentUser } Install-RequiredModule -RequiredModulesFile ('{0}\RequiredModules.psd1' -f $PSScriptRoot) -Scope CurrentUser -TrustRegisteredRepositories -Import -Quiet +Import-Module 'R:\Development\Docusaurus.PowerShell\Output\Alt3.Docusaurus.PowerShell\1.0.34\Alt3.Docusaurus.PowerShell.psd1' -Force # Use strict mode when building. Set-StrictMode -Version Latest # Helper: Get the module PSD1 file path. diff --git a/test.ps1 b/test.ps1 index db18a77..e765273 100644 --- a/test.ps1 +++ b/test.ps1 @@ -1,49 +1,49 @@ -#requires -Module PowerShellGet, @{ ModuleName = 'Pester'; ModuleVersion = '5.5.0'; MaximumVersion = '5.999' } -using namespace Microsoft.PackageManagement.Provider.Utility -using namespace System.Management.Automation -param( - [switch]$SkipScriptAnalyzer, - [switch]$IncludeVSCodeMarker -) -Push-Location $PSScriptRoot -$ModulePath = Resolve-Path -Path '.\Output\*\*' | Sort-Object -Property BaseName | Select-Object -Last 1 -ExpandProperty Path -$ModuleName = Get-ChildItem -Path ('{0}\*' -f $ModulePath) -Filter '*.psd1' -Exclude 'build.psd1' | Select-Object -ExpandProperty BaseName -# Disable default parameters during testing, just in case -$PSDefaultParameterValues += @{} -$PSDefaultParameterValues['Disabled'] = $true -# Find a built module as a version-numbered folder: -$VersionDirectory = Resolve-Path -Path '.\Output\*\*' -if ($VersionDirectory) { - $TestDirectory = $VersionDirectory | Sort-Object { $_.Name -as [SemanticVersion[]] } | Select-Object -Last 1 -} else { - $TestDirectory = Get-Item -Path '.\Source' -} -$FoundModule = $TestDirectory | Get-ChildItem -Filter ('{0}.psd1' -f $ModuleName) -if (!$FoundModule) { - throw ('Cannot find {0}.psd1 in {1}' -f $ModuleName, $TestDirectory.FullName) -} -Remove-Module $ModuleName -ErrorAction Ignore -Force -$ModuleUnderTest = Import-Module $FoundModule.FullName -PassThru -Force -DisableNameChecking -Verbose:$false -Write-Verbose ('Invoke-Pester for Module {0} version {1}' -f $ModuleUnderTest, $ModuleUnderTest.Version) -$PesterConfiguration = New-PesterConfiguration -$PesterConfiguration.CodeCoverage.Enabled = $true -$PesterConfiguration.CodeCoverage.OutputPath = '.\.artifacts\CodeCoverage.xml' -$PesterConfiguration.Output.Verbosity = 'Detailed' -$PesterConfiguration.Run.Path = '.\Tests' -$PesterConfiguration.Run.PassThru = $true -$PesterConfiguration.TestResult.Enabled = $true -$PesterConfiguration.TestResult.OutputPath = '.\.artifacts\TestResults.xml' -$PesterConfiguration.TestResult.OutputFormat = 'JUnitXML' -if ($IncludeVSCodeMarker) { - $PesterConfiguration.VSCodeMarker = $true -} - -Invoke-Pester -Configuration $PesterConfiguration - -if (-not $SkipScriptAnalyzer) { - Invoke-ScriptAnalyzer $ModuleUnderTest.Path -Settings .\PSScriptAnalyzerSettings.psd1 -} -Pop-Location - -# Re-enable default parameters after testing -$PSDefaultParameterValues['Disabled'] = $false +#requires -Module PowerShellGet, @{ ModuleName = 'Pester'; ModuleVersion = '5.5.0'; MaximumVersion = '5.999' } +using namespace Microsoft.PackageManagement.Provider.Utility +using namespace System.Management.Automation +param( + [switch]$SkipScriptAnalyzer, + [switch]$IncludeVSCodeMarker +) +Push-Location $PSScriptRoot +$ModulePath = Resolve-Path -Path '.\Output\*\*' | Sort-Object -Property BaseName | Select-Object -Last 1 -ExpandProperty Path +$ModuleName = Get-ChildItem -Path ('{0}\*' -f $ModulePath) -Filter '*.psd1' -Exclude 'build.psd1' | Select-Object -ExpandProperty BaseName +# Disable default parameters during testing, just in case +$PSDefaultParameterValues += @{} +$PSDefaultParameterValues['Disabled'] = $true +# Find a built module as a version-numbered folder: +$VersionDirectory = Resolve-Path -Path '.\Output\*\*' +if ($VersionDirectory) { + $TestDirectory = $VersionDirectory | Sort-Object { $_.Name -as [SemanticVersion[]] } | Select-Object -Last 1 +} else { + $TestDirectory = Get-Item -Path '.\Source' +} +$FoundModule = $TestDirectory | Get-ChildItem -Filter ('{0}.psd1' -f $ModuleName) +if (!$FoundModule) { + throw ('Cannot find {0}.psd1 in {1}' -f $ModuleName, $TestDirectory.FullName) +} +Remove-Module $ModuleName -ErrorAction Ignore -Force +$ModuleUnderTest = Import-Module $FoundModule.FullName -PassThru -Force -DisableNameChecking -Verbose:$false +Write-Verbose ('Invoke-Pester for Module {0} version {1}' -f $ModuleUnderTest, $ModuleUnderTest.Version) +$PesterConfiguration = New-PesterConfiguration +$PesterConfiguration.CodeCoverage.Enabled = $true +$PesterConfiguration.CodeCoverage.OutputPath = '.\.artifacts\CodeCoverage.xml' +$PesterConfiguration.Output.Verbosity = 'Detailed' +$PesterConfiguration.Run.Path = '.\Tests' +$PesterConfiguration.Run.PassThru = $true +$PesterConfiguration.TestResult.Enabled = $true +$PesterConfiguration.TestResult.OutputPath = '.\.artifacts\TestResults.xml' +$PesterConfiguration.TestResult.OutputFormat = 'JUnitXML' +if ($IncludeVSCodeMarker) { + $PesterConfiguration.VSCodeMarker = $true +} + +Invoke-Pester -Configuration $PesterConfiguration + +if (-not $SkipScriptAnalyzer) { + Invoke-ScriptAnalyzer $ModuleUnderTest.Path -Settings .\PSScriptAnalyzerSettings.psd1 +} +Pop-Location + +# Re-enable default parameters after testing +$PSDefaultParameterValues['Disabled'] = $false