Questions tagged [powershell-module]

Powershell Modules are sets of related Windows PowerShell functionalities that can be dynamic or persist on disk. Modules can contain cmdlets, providers, functions, variables, aliases and PowerShell drives.

A Powershell Module is a set of related Windows PowerShell functionalities that can be dynamic or persist on disk. Modules that persist on disk are referenced, loaded, and persisted as script modules, binary modules, or manifest modules.

Related Cmdlets

  • ImportSystemModules
  • New-Module
  • Import-Module
  • Export-ModuleMember
  • Get-Module
  • Remove-Module
  • New-ModuleManifest
  • Test-ModuleManifest
203 questions
5
votes
2 answers

Powershell run script with Import-Module

I have created a module for my admin group with some functions that automate some procedures we commonly perform (add administrators to remote machines, C drive cleanup, etc...) One of the prerequisites for these functions is the generation of a…
Acerbity
  • 417
  • 1
  • 11
  • 29
5
votes
4 answers

Can I exclude a single function from Export-ModuleMember?

I have a large set of functions defined in a PowerShell script module. I want to use Export-ModuleMember -Function *, but I want to exclude just one function. It'll be easier for me to exclude this one function than to list all the included…
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
4
votes
0 answers

How to import modules in background in powershell?

I have a few modules in my powershell profile, and their loading sometimes takes a lot of time (10-15s). I would like to load them in a background thread using something like this: Start-Job -ScriptBlock { Import-Module -Global DockerCompletion…
4
votes
1 answer

Call function from module inside a runspace

I have some functions in a module I would like to call from a runspace but It´s not working. I assume that I somehow have to send the module to the runspace. The example below works fine. $hash =…
4
votes
0 answers

Module available but not reported as installed

Using PowerShell (version 5.1.17134.228), found some unexpected differences between Get-Module and Get-InstalledModule, in that some modules that I'd expect to be returned by Get-InstalledModule are not. As an example: Get-Module -ListAvailable…
ZenoArrow
  • 697
  • 7
  • 21
4
votes
0 answers

Getting error: "PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object."

While running PowerShell script as Register-PSRepository -Name XYZ -SourceLocation https://urlname/api/v3 I get error: PackageManagement\Register-PackageSource : The property 'Name' cannot be found on this object. Verify that the property…
Pradeep Gupta
  • 235
  • 3
  • 14
4
votes
2 answers

How to make sure PowerShell module manifest (.psd1) is used

I created a PowerShell module MyUtil.psm1 and a manifest file MyUtil.psd1 for it. In the psd1 file it has the prefix defined to prevent name conflicts for exported functions: DefaultCommandPrefix = 'MyToolbox' This way, after running Import-Module…
w2000
  • 73
  • 8
4
votes
2 answers

Scriptblock does not get pipeline variable binding when passed as argument to module function

I'm trying to put this function: function Test-Any { [CmdletBinding()] param($EvaluateCondition, [Parameter(ValueFromPipeline = $true)] $ObjectToTest) begin { $any = $false } process { if (-not $any -and…
Voo
  • 29,040
  • 11
  • 82
  • 156
4
votes
2 answers

How do I turn a collection of script files into a module?

Do you guys know, whether it's possible to convert PowerShell project consisting solely of functions, into module? What I want to achieve is to create distributable module of all my functions so others can use it. But without spending time of…
Martinecko
  • 1,719
  • 4
  • 22
  • 35
3
votes
1 answer

Powershell 5.1: alias descriptions are missing in my module

I have a module PhriInfrastructure which codifies our DevOps procedures at my organization. It has a function Test-IsLocalhost that I've aliased to Get-IsLocalhost for backwards-compatibility reasons. I've tried to apply a description to the alias,…
Pxtl
  • 880
  • 8
  • 18
3
votes
1 answer

Commandlets from a custom Module not being recognised

I have a custom Powershell module I have been working on for the past few days, I am now trying to integrate it into powershell as a module that always gets auto loaded. My module is placed under the C:\Users\...\Documents\PowerShell\Modules ,…
3
votes
1 answer

Why can't export variable members in a PowerShell module using VariablesToExport?

From How to Write a PowerShell Module Manifest I learned that I can export all the variables in the module using VariablesToExport = '*'. However, after using it, I found that I could not export any variables. After writing tests to confirm and…
Andy
  • 1,077
  • 1
  • 8
  • 20
3
votes
1 answer

PowerShell Module Deployment Duplication

I am using Azure DevOps to deploy PowerShell modules to a server. This release task deploys the modules to the directory C:\Windows\System32\WindowsPowerShell\v1.0\Modules\. I am able to use the modules once they are deployed to this folder…
Alex Wiese
  • 8,142
  • 6
  • 42
  • 71
3
votes
2 answers

The term 'New-AzureRmUserAssignedIdentity' is not recognized as the name

I'm trying to create user assigned identity, the documentation says that 6.13 should include this function: https://learn.microsoft.com/en-us/powershell/module/azurerm.managedserviceidentity/new-azurermuserassignedidentity?view=azurermps-6.13.0 I…
3
votes
1 answer

PowerShell Module Manifest FileList property - specifically what does it do?

So I am trying to refine my PowerShell module skills. There is a parameter in the module manifest (.psd1) called 'FileList'. It has the helpful documentation # List of all files packaged with this module FileList = @() So, I have a module that…
Turtle1363
  • 312
  • 3
  • 16
1 2
3
13 14