Hi, I have installed MilestonePSTools to my workstations and created a .json file to import a new role with overall security set. I had received a command to add for importing the file to the management server as seen below: -
It seems Import-Role function is not recognised as I receive the below: -
The term ‘Import-Role’ is not recognized as the name of a cmdlet, function, script file, or operable program.
I have noticed from some MilstonePSTools videos that some functions on the video do not exist on mine. Is this a version issue as I have the most recent version, or do I need to install additional features to the module? Or is there a completely different function to use that I may be over looking?
About two years ago I pushed a MilestonePSTools.Security module to PowerShell Gallery which includes the following functions:
Export-Role
Import-Role
Set-RoleMembership
Get-ViewGroupPermission
Set-ViewGroupPermission
If you install this module in addition to MilestonePSTools, you should have the Import-Role function available to you. However it’s been a while since I’ve used those functions so your mileage may vary. Like any exploration/testing of an automation tool, please try it out in a test environment or at least perform a configuration backup in Management Client.
Install-Module -Name MilestonePSTools.Security
Back in 2021 my thinking was that the core MilestonePSTools module should be as “un-opinionated” as possible. That it should more or less provide the basic “CRUD” (create, read, update, delete) functions for all the resource types (cameras, users, events, etc). Then some opinionated functions could be provided in separate modules for bulk import/export via a specific file type, or for more specialized reporting for example.
Ultimately I’m leaning toward wanting to provide those simple import/export functions in the core module and avoid having modules on the side for now. For even more specialized functions/scripts/examples, we would host them at MilestonePSTools.com and/or in the PowerShellSamples GitHub repo. Hopefully that older Import-Role function works for you as-is since you’ve already invested some time into preparing your JSON. Going forward I expect to add Export-VmsRole and Import-VmsRole functions to accompany the recently added *VmsRole* functions available in the latest release of MilestonePSTools: