forked from homotechsual/NinjaOne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNinjaOne.psm1
114 lines (114 loc) · 6.98 KB
/
NinjaOne.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
$Enums = @(Get-ChildItem -Path $PSScriptRoot\Classes\Enums -Include *.ps1 -Recurse)
# Import enums.
Write-Verbose "Discovered validators $($Enums | Out-String)"
foreach ($Enum in @($Enums)) {
try {
Write-Verbose "Importing class $($Enum.FullName)"
. $Enum.FullName
} catch {
Write-Error -Message "Failed to import class $($Enum.FullName): $_"
}
}
$Validators = @(Get-ChildItem -Path $PSScriptRoot\Classes\Validators -Include *.ps1 -Recurse)
# Import validators.
Write-Verbose "Discovered validators $($Validators | Out-String)"
foreach ($Validator in @($Validators)) {
try {
Write-Verbose "Importing class $($Validator.FullName)"
. $Validator.FullName
} catch {
Write-Error -Message "Failed to import class $($Validator.FullName): $_"
}
}
$Objects = @(Get-ChildItem -Path $PSScriptRoot\Classes\Object -Include *.ps1 -Recurse)
# Import objects.
Write-Verbose "Discovered objects $($Objects | Out-String)"
foreach ($Object in @($Objects)) {
try {
Write-Verbose "Importing class $($Object.FullName)"
. $Object.FullName
} catch {
Write-Error -Message "Failed to import class $($Object.FullName): $_"
}
}
$Functions = @(Get-ChildItem -Path $PSScriptRoot\Public\ -Include *.ps1 -Recurse) + @(Get-ChildItem -Path $PSScriptRoot\Private\ -Include *.ps1 -Recurse)
# Import functions.
Write-Verbose "Discovered functions $($Functions | Out-String)"
foreach ($Function in @($Functions)) {
try {
Write-Verbose "Importing function $($Function.FullName)"
. $Function.FullName
} catch {
Write-Error -Message "Failed to import function $($Function.FullName): $_"
}
}
[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'
}
New-Alias -Name 'Connect-NinjaRMM' -Value 'Connect-NinjaOne'
New-Alias -Name 'Find-NinjaRMMDevices' -Value 'Find-NinjaOneDevices'
New-Alias -Name 'Get-NinjaRMMActivities' -Value 'Get-NinjaOneActivities'
New-Alias -Name 'Get-NinjaRMMAlerts' -Value 'Get-NinjaOneAlerts'
New-Alias -Name 'Get-NinjaRMMDeviceCustomFields' -Value 'Get-NinjaOneDeviceCustomFields'
New-Alias -Name 'Get-NinjaRMMDeviceDisks' -Value 'Get-NinjaOneDeviceDisks'
New-Alias -Name 'Get-NinjaRMMDeviceLastLoggedOnUser' -Value 'Get-NinjaOneDeviceLastLoggedOnUser'
New-Alias -Name 'Get-NinjaRMMDeviceOSPatches' -Value 'Get-NinjaOneDeviceOSPatches'
New-Alias -Name 'Get-NinjaRMMDeviceOSPatchInstalls' -Value 'Get-NinjaOneDeviceOSPatchInstalls'
New-Alias -Name 'Get-NinjaRMMDeviceProcessors' -Value 'Get-NinjaOneDeviceProcessors'
New-Alias -Name 'Get-NinjaRMMDevices' -Value 'Get-NinjaOneDevices'
New-Alias -Name 'Get-NinjaRMMDeviceSoftwarePatches' -Value 'Get-NinjaOneDeviceSoftwarePatches'
New-Alias -Name 'Get-NinjaRMMDeviceSoftwarePatchInstalls' -Value 'Get-NinjaOneDeviceSoftwarePatchInstalls'
New-Alias -Name 'Get-NinjaRMMDeviceVolumes' -Value 'Get-NinjaOneDeviceVolumes'
New-Alias -Name 'Get-NinjaRMMDeviceWindowsServices' -Value 'Get-NinjaOneDeviceWindowsServices'
New-Alias -Name 'Get-NinjaRMMGroupMembers' -Value 'Get-NinjaOneGroupMembers'
New-Alias -Name 'Get-NinjaRMMGroups' -Value 'Get-NinjaOneGroups'
New-Alias -Name 'Get-NinjaRMMJobs' -Value 'Get-NinjaOneJobs'
New-Alias -Name 'Get-NinjaRMMLocations' -Value 'Get-NinjaOneLocations'
New-Alias -Name 'Get-NinjaRMMOrganisationDocuments' -Value 'Get-NinjaOneOrganisationDocuments'
New-Alias -Name 'Get-NinjaRMMOrganizationDocuments' -Value 'Get-NinjaOneOrganizationDocuments'
New-Alias -Name 'Get-NinjaOneOrganizationDocuments' -Value 'Get-NinjaOneOrganisationDocuments'
New-Alias -Name 'Get-NinjaRMMOrganisations' -Value 'Get-NinjaOneOrganisations'
New-Alias -Name 'Get-NinjaRMMOrganizations' -Value 'Get-NinjaOneOrganisations'
New-Alias -Name 'Get-NinjaOneOrganizations' -Value 'Get-NinjaOneOrganisations'
New-Alias -Name 'Get-NinjaRMMPolicies' -Value 'Get-NinjaOnePolicies'
New-Alias -Name 'Get-NinjaRMMRoles' -Value 'Get-NinjaOneRoles'
New-Alias -Name 'Get-NinjaRMMSoftwareProducts' -Value 'Get-NinjaOneSoftwareProducts'
New-Alias -Name 'Get-NinjaRMMTasks' -Value 'Get-NinjaOneTasks'
New-Alias -Name 'Get-NinjaRMMUsers' -Value 'Get-NinjaOneUsers'
New-Alias -Name 'Get-NinjaRMMDeviceDashboardURL' -Value 'Get-NinjaOneDeviceDashboardURL'
New-Alias -Name 'Get-NinjaRMMDeviceScriptingOptions' -Value 'Get-NinjaOneDeviceScriptingOptions'
New-Alias -Name 'Get-NinjaRMMInstaller' -Value 'Get-NinjaOneInstaller'
New-Alias -Name 'Get-NinjaRMMAntivirusStatus' -Value 'Get-NinjaOneAntivirusStatus'
New-Alias -Name 'Get-NinjaRMMAntivirusThreats' -Value 'Get-NinjaOneAntivirusThreats'
New-Alias -Name 'Get-NinjaRMMComputerSystems' -Value 'Get-NinjaOneComputerSystems'
New-Alias -Name 'Get-NinjaRMMCustomFields' -Value 'Get-NinjaOneCustomFields'
New-Alias -Name 'Get-NinjaRMMDeviceHealth' -Value 'Get-NinjaOneDeviceHealth'
New-Alias -Name 'Get-NinjaRMMDisks' -Value 'Get-NinjaOneDisks'
New-Alias -Name 'Get-NinjaRMMLoggedOnUsers' -Value 'Get-NinjaOneLoggedOnUsers'
New-Alias -Name 'Get-NinjaRMMOperatingSystems' -Value 'Get-NinjaOneOperatingSystems'
New-Alias -Name 'Get-NinjaRMMOSPatches' -Value 'Get-NinjaOneOSPatches'
New-Alias -Name 'Get-NinjaRMMOSPatchInstalls' -Value 'Get-NinjaOneOSPatchInstalls'
New-Alias -Name 'Get-NinjaRMMProcessors' -Value 'Get-NinjaOneProcessors'
New-Alias -Name 'Get-NinjaRMMRAIDControllers' -Value 'Get-NinjaOneRAIDControllers'
New-Alias -Name 'Get-NinjaRMMRAIDDrives' -Value 'Get-NinjaOneRAIDDrives'
New-Alias -Name 'Get-NinjaRMMSoftwareInventory' -Value 'Get-NinjaOneSoftwareInventory'
New-Alias -Name 'Get-NinjaRMMSoftwarePatches' -Value 'Get-NinjaOneSoftwarePatches'
New-Alias -Name 'Get-NinjaRMMSoftwarePatchInstalls' -Value 'Get-NinjaOneSoftwarePatchInstalls'
New-Alias -Name 'Get-NinjaRMMVolumes' -Value 'Get-NinjaOneVolumes'
New-Alias -Name 'Get-NinjaRMMWindowsServices' -Value 'Get-NinjaOneWindowsServices'
New-Alias -Name 'New-NinjaOneOrganization' -Value 'New-NinjaOneOrganisation'
New-Alias -Name 'Update-NinjaOneOrganization' -Value 'Update-NinjaOneOrganisation'
New-Alias -Name 'Update-NinjaOneOrganizationDocument' -Value 'Update-NinjaOneOrganisationDocument'
New-Alias -Name 'Get-NinjaOneBoards' -Value 'Get-NinjaOneTicketBoards'
New-Alias -Name 'Update-NinjaOneOrganisationCustomFields' -Value 'Set-NinjaOneOrganisationCustomFields'
New-Alias -Name 'Update-NinjaOneLocationCustomFields' -Value 'Set-NinjaOneLocationCustomFields'
New-Alias -Name 'Update-NinjaOneOrganizationCustomFields' -Value 'Set-NinjaOneOrganisationCustomFields'
New-Alias -Name 'Set-OrganizationCustomFields' -Value 'Set-NinjaOneOrganisationCustomFields'
New-Alias -Name 'Update-NinjaOneDeviceCustomFields' -Value 'Set-NinjaOneDeviceCustomFields'
New-Alias -Name 'Get-NinjaOneOrganizationCustomFields' -Value 'Get-NinjaOneOrganisationCustomFields'
New-Alias -Name 'Get-NinjaOneDevice' -Value 'Get-NinjaOneDevices'
Export-ModuleMember -Function $Functions.BaseName -Alias *