Skip to content

hao-public/Capa.PowerShell.Module

 
 

Repository files navigation

Capa.PowerShell.Module

This modules is made to use CapaInstaller Software Development Kit functions in PowerShell 7 and now also supports PowerPacks. Any help and feedback is welcome! 😁

Installation

There is two ways to install the module. But both ways also needs you to fulfill the requirements that can be found here.

With MSI 🤖

Run the installer

Copy paste the files 📂

To one of the paths you find when running

$env:PSModulePath

Copy all folders from Modules

How to use 🛠️

For the SDK part of the module to work correctly, you need to run PowerShell as an administrator or else you will get the error

OperationStopped: Requested registry access is not allowed.

When running the command Initialize-CapaSDK because it sets a splitter used to spilt returned array so it is made into an object array. For more documentation look in the documentation folder.

How to import module

You can import the whole module

Import-Module Capa.PowerShell.Module

You can import only the SDK part of the module

Import-Module Capa.PowerShell.Module.SDK

Or you can import smaller part of the module

Import-Module Capa.PowerShell.Module.SDK.Authentication
Import-Module Capa.PowerShell.Module.SDK.User

PowerPack

To import all PowerPack commands run

    Import-Module Capa.PowerShell.Module.PowerPack

There are some usefull VSCode PowerPack snippets that you can use if you want to.

Working with Git when creating or updating a package

If you want to know how to use Git when creating or updating a package, you can read this document.

A exampel

Import-Module Capa.PowerShell.Module.SDK.Authentication
Import-Module Capa.PowerShell.Module.SDK.Units
<#
    .NOTES
    ===========================================================================
    Created with: 	Visual Studio Code
    Created on: 
    Created by:   	MARA
    Organization: IT-Center Fyn
    Filename:
    ===========================================================================
    .DESCRIPTION
        TODO: A description of the file.
#>
##################
### PARAMETERS ###
##################
# DO NOT CHANGE
# Change as needed
$CapaServer = 'CISRVKURSUS'
$Database = 'CapaInstaller'
$DefaultManagementPointDev = '1'
$DefaultManagementPointProd = $null #Keep null if you don't have two enviroments

#################
### FUNCTIONS ###
#################

##############
### SCRIPT ###
##############

If ($DefaultManagementPointProd -eq $null){
    $oCMSDev = Initialize-CapaSDK -Server $CapaServer -Database $Database
    $oCMSProd = $oCMSDev
}
else{
    $oCMSDev = Initialize-CapaSDK -Server $CapaServer -Database $Database -DefaultManagementPoint $DefaultManagementPointDev
    $oCMSProd = Initialize-CapaSDK -Server $CapaServer -Database $Database -DefaultManagementPoint $DefaultManagementPointProd
}

Get-CapaUnits -CapaSDK $oCMSDev

Output:

Name           : CIKURSUS
Created        : 11-11-2021 14:24:23
LastExecuted   : 22-03-2023 19:14:03
Status         : Active
Description    : 
GUID           : bc79d9fc-67d8-4221-bd81-423652ed7615
ID             : 2
TypeName       : Users
UUID           : 9401eb49-26d5-42f6-adec-edc9c1e619b8
IsMobileDevice : False
Location       : CIKURSUS.LOCAL

Name           : ADMINISTRATOR
Created        : 18-11-2021 15:11:46
LastExecuted   : 18-11-2021 15:12:45
Status         : Active
Description    : 
GUID           : 883853dc-fafd-4a94-9a85-dff6e8d360e1
ID             : 6
TypeName       : Users
UUID           : 65654f58-ab21-46e1-8cfb-f3ce7aea11e8
IsMobileDevice : False
Location       : CIKURSUS.LOCAL

About

PowerShell Module to use CapaInstaller SDK kit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 100.0%