PowerShellGet | PowerShellGet is the package manager for PowerShell | Command Line Interface library
kandi X-RAY | PowerShellGet Summary
kandi X-RAY | PowerShellGet Summary
PowerShellGet is a PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts. PowerShellGet module is also integrated with the PackageManagement module as a provider, users can also use the PackageManagement cmdlets for discovering, installing and updating the PowerShell artifacts like Modules and Scripts.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PowerShellGet
PowerShellGet Key Features
PowerShellGet Examples and Code Snippets
Community Discussions
Trending Discussions on PowerShellGet
QUESTION
I'm trying to create new Azure Monitor Alert using PS script. I'm using MS documentation here: https://docs.microsoft.com/en-us/powershell/module/az.monitor/add-azmetricalertrulev2?view=azps-5.9.0
Steps to reproduce$condition = New-AzMetricAlertRuleV2Criteria -MetricName "SqlDbDtuUsageMetric" -MetricNameSpace "Microsoft.Sql/servers/databases" -TimeAggregation Average -Operator GreaterThan -Threshold 5
$act = New-AzActionGroup -ActionGroupId /subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/microsoft.insights/actionGroups/SqlDbDtuUsageAction
Add-AzMetricAlertRuleV2 -Name "SqlDbDtuUsageAlertGt5" -ResourceGroupName {resource_group} -WindowSize 00:05:00 -Frequency 00:05:00 -TargetResourceId "/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Sql/servers/{sql_server}/databases/vi{sql_db}" -Description "Alerting when max used DTU is > 20" -Severity 3 -ActionGroup $act -Condition $condition
Error outputWARNING: 09:04:18 - *** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases. WARNING: 09:04:18 - *** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes. VERBOSE: Performing the operation "Create/update an alert rule" on target "Create/update an alert rule: SqlDbDtuUsageAlertGt5 from resource group: vi-prod-be-cin-rg". Add-AzMetricAlertRuleV2 : Exception type: ErrorResponseException, Message: Couldn't find a metric named metric1. Make sure the name is correct. Activity ID: 3e7e537e-43fc-40ad-8a84-745df33e1668., Code: BadRequest, Status code:BadRequest, Reason phrase: BadRequest At line:1 char:1
- Add-AzMetricAlertRuleV2 -Name "SqlDbDtuUsageAlertGt5" -ResourceGroupN ...
- ...
ANSWER
Answered 2021-May-25 at 01:40According to the error, the MetricNameSpace Microsoft.Sql/servers/databases
does not contain metric SqlDbDtuUsageMetric
. Regarding the supported metric, please use the following command to get
QUESTION
I installed powershell (pwsh) on Ubuntu 20.4. I am trying to manage some Sharepoint stuff. I did the following:
...ANSWER
Answered 2021-May-16 at 11:13The Sharepoint module is for Windows PowerShell Edition and not for PowerShell Core Edition :
QUESTION
I want to install Docker and so I tried the below command which gave an error
PS C:\Windows\system32> Install-Module -Name DockerMsftProvider PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'DockerMsftProvider'. Try Get-PSRepository to see all available registered module repositories. At C:\Program Files\ WindowsPowerShell\ Modules\ PowerShellGet\ 1.0.0.1\ PSModule .psm1:1772 char:21 $null = PackageManagement\Install-Package @PSBoundParameters CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception + FullyQualifiedErrorId : NoMatchFoundForCriteria, Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
even Install-Module -Name DockerMsftProvider -Repository PSGallery -Force gave the same error.
I tried the below resources and still its the same. I am not able to register a PSRepository. Only when this is installed I can install Docker in Windows Server. I spent hours to solve this still at 0% progress. Registering the PSRepository (Register-PSRepository -Default -InstallationPolicy Trusted) went fine without any errors but still its not visible.
Any possible help to solve this?
https://copdips.com/2018/05/setting-up-powershell-gallery-and-nuget-gallery-for-powershell.html
WARNING: Unable to find module repositories
Unable to find module providers
https://www.powershellgallery.com/packages/PowerShellGet/2.2.1
...ANSWER
Answered 2021-May-11 at 09:39Try running this, do you still get an error?
QUESTION
I know nothing of PowerShell, but I wanted to install this: https://www.powershellgallery.com/packages/lolcat/
So, I start PowerShell as administrator, and:
...ANSWER
Answered 2021-Apr-25 at 20:00The error is due to the fact that the -File
parameter from the powershell.exe excepts a .ps1
file.
If you want to run C:\Program Files\WindowsPowerShell\Modules\lolcat\1.0.7\lolcat.psm1
from cmd, make a .ps1
script where you can write something like
QUESTION
I have tried using the basic commands from multiple websites and videos, but after installing AWS.Tools.Installer and AWS.Tools.S3 I get the same error when trying to use a command:
...ANSWER
Answered 2021-Apr-22 at 23:57Though you can download and install the PS AWS tools, they are already available to you via MS powershellgallery.com (as stated on the AWS PS Tool site - https://aws.amazon.com/powershell).
QUESTION
I'm trying to run Docker in process isolation mode on Windows Server 2019 (Docker Desktop does not work here, my VPS does not support Hyper-V).
I run this in PowerShell (all in Administrator mode)
docker run -it --isolation=process mcr.microsoft.com/windows/servercore:ltsc2019 cmd.exe /c ping 127.0.0.1 -t
Then I get error:
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create: open //./pipe/docker_engine: The system cannot find the file specified. See 'docker run --help'.
I ran command & 'C:\Program Files\Docker\DockerCli.exe' -SwitchDaemon
, as suggested here: Docker cannot start on Windows
However, DockerCli.exe
does not exist in a clean Docker install:
As suggested here I tried copying the file DockerCli.exe
from my local Windows 10 Docker Desktop installation and reran, but then I get:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Docker.Core, Version=3.0.0.50646, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at Docker.Cli.MainBackendCli.Run(IReadOnlyCollection`1 args) at Docker.Cli.MainBackendCli.Main(String[] args)
Regardless, copying files from Docker Desktop does not feel like the right approach.
I then ran dockerd
in PowerShell since that's the only other executable in that folder:
Since I'm a newbie, I'm not sure if I just started a container and if so, which one, I just see start.
, but no idea where that comes from or how I can configure it.
UPDATE 1
Based on Peter Wishart's suggestion I tried uninstall-Package -Name docker
, but then I get
ANSWER
Answered 2021-Apr-21 at 11:11The pipe access that the error message mentions is a (probably unrelated) issue when docker
client is run by non-admin users (see here).
I think the most likely explanation is that the docker service has failed to start.
When you ran dockerd
you were actually starting an instance of the daemon - and the line API listen on //./pipe/docker_engine
means that the system service hadn't started previously - as the instance you started could create the pipe.
If you stop the running dockerd
instance and run:
QUESTION
Trying to install Docker in process isolation on Windows Server 2019 and following these steps. (I can't use Hyper-V on this server) when running PowerShell in admin mode.
I however get the error
Get-PackageProvider : A parameter cannot be found that matches parameter name 'ListAvailableget-packagesource'
I also tried Install-Package -Name docker -ProviderName DockerMsftProvider
I then get:
ANSWER
Answered 2021-Apr-19 at 10:46I use a script that installs the containers feature and uninstalls Windows Defender (n.b. this may or may not be safe for your environment):
QUESTION
I recently created an Azure Artifacts feed for one of the projects in my organization. I followed the instructions at this link.
Most things work. In particular, I'm able to:
- Create the feed
- Use
nuget
to push a package to said feed - Register the feed with PowerShell via
Register-PSRepository
- Run
Find-Module -Repository
The last bit -- running Find-Module
-- generates the expected output, viz., a single module with the expected version, name, and description. However, I get the following message when I attempt Install-Module
:
ANSWER
Answered 2021-Apr-08 at 02:43If you want to install the custom package in the Azure DevOps pipeline, you could add task power shell and run the script Install-Package ADHelpers -Scope CurrentUser -Force
to install the package.
In my sample, the package name is Get-Hello and the result is:
You could refer to this blog and my previous answers for more details
QUESTION
Credit to mklement0
Here's what I ended up doing to publish my bin\MyModule.0.1.0.nupkg
module to PSGallery:
- Rename
bin\MyModule.0.1.0.nupkg
tobin\MyModule.0.1.0.zip
- Extract
bin\MyModule.0.1.0.zip
tobin\MyModule\
(the name of the extracted folder had to match the name of the.psd1
file inside, so in my case there was now abin\MyModule\MyModule.psd1
file). - Delete the
[Content_Types].xml
file from inside the extracted folder (not deleting this causes an error when you try to download and install the module from PSGallery, seemingly caused by 2 copies of that file being present in the resulting.nupkg
).
Then I was able to run this command:
...ANSWER
Answered 2021-Feb-18 at 04:27As of version 2.2.5 of the PowerShellGet
module - the one that comes with preview versions of PowerShell 7.2 - the Publish-Module
cmdlet for publishing PowerShell modules to the PowerShell Gallery does not support uploading .nupkg
files.
Instead, it requires a (non-compressed) directory containing the PowerShell module to publish[1], which is then compressed into a (temporary) NuGet package (.nupkg
archive) behind the scenes and uploaded to the gallery.
I'm not familiar with AutoRest.PowerShell, but if it claims that the .nupkg
archives it creates are compatible with the PowerShell Gallery you can try to extract (uncompress) such an archive (NuGet files are ZIP archives, so you can pass them to Expand-Archive
) into a directory and try to pass that directory's path to Publish-Module
's -Path
parameter (choose the directory that contains the module manifest file (.psd1
), which may be a subfolder).
[1] If the module to publish is located in one of the directories listed in $env:PSModulePath
, its directory location can be inferred from the module's name, passed to the -Name
parameter.
QUESTION
I'm trying to take advantage of the PowerShell Gallery which requires Install-Module. For some reason I cannot get this to work on any computer I have access to:
...ANSWER
Answered 2021-Feb-16 at 02:58As you've discovered yourself, it was the presence of machine-level environment variable __PSLockDownPolicy
that prevented Install-Module
from running (see below for general prerequisites).
This undocumented environment variable, effective on Windows only, is for security reasons only respected if defined at the machine level via the registry (rather than as a per-user or process-specific variable) and can be used to restrict what is allowed in a PowerShell session.
Values 4
through 7
result in PowerShell operating in constrained language mode, where only a handful of pre-approved .NET types may be used, which as a result prevents the PowerShellGet
module that contains the Install-Module
from loading - see the conceptual about_Language Modes help topic.
You can check what language mode is in effect in a given session by executing $ExecutionContext.SessionState.LanguageMode
; in constrained mode, the result is ConstrainedLanguage
; FullLanguage
indicates that no language restrictions are in place.
Looking at PowerShell's source code, the fact that this variable is checked inside a method named GetDebugLockdownPolicy()
suggests that it isn't officially supported.
For more information, see this archived blog post.
The simplest way to remove this restriction is to delete the environment variable, by running the following from an elevated PowerShell prompt:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PowerShellGet
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page