I see in powershell gallery that there is a newer version of the iisadministration module than the one that shipped with Server 2016.
I got it installed using:
install-module -name IISadministration -scope currentuser -verbose -force -SkipPublisherCheck
I now have two versions, the newer one installed for the currentuser and the original that shipped with the OS.
Import-Module IISAdministration was successful and so was explicitly specifying the psd1 path. However, when I try to use New-IISSiteBinding (included in the newer version), it complains that the cmdlet is not recognized.
Article referencing the new cmdlt
https://blogs.iis.net/iisteam/introducing-iisadministration-in-the-powershell-gallery
Can anyone please help? Thanks
Related
I am relying on the Powershell cmdlet Apply-PnPProvisioningTemplate to automate deployment of Sharepoint-Templates to new sites.
Have always used the "SharePointPnPPowerShellOnline" Powershell module where it exists, but when importing it, it said that it's about to be retired.
WARNING: You are running the legacy version of PnP PowerShell. This
version will be archived soon which means that while staying
available, no updates or fixes will be released. Consider installing
the newer prereleased cross-platform version of PnP PowerShell:
Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions
-Force Install-Module -Name PnP.PowerShell -AllowPrerelease
Read more about the new cross-platform version of PnP PowerShell at
https://pnp.github.io/powershell
The new version of PnP PowerShell will be released as 1.0 in January
2021.
*The problem is that the new module doesn't seem to include any of the -PNPProvisioningTemplate cmdlets.
Anyone know how to apply a pnpprovisioning template now or has the cmdlets been renamed?
There is also a bug with the Apply-PnPProvisioningTemplate cmdlet in the SharePointPnPPowerShellOnline module, that forces me to use a very old version 3.23.2007.1... But now I know that that bug will never be fixed.
Take a look
https://github.com/pnp/powershell/issues/179#issuecomment-767683904
It states that you should use
Invoke-PnPSiteTemplate
I have an error in the PowerShell console with Chocolatey's link.
chocolatey's link error
If have not a solution, I need to learn how to install Chocolatey with the downloaded file "chocolatey.0.10.15.nupkg".
chocolatey's file .nupkg
Installing choco is a very common use case, including NuGet.
PowerShell already comes with a package manager that uses NuGet that it already installs by default. You can still install choco for other reasons, but for every day, normal PowerShell use, it's not needed.
Installing PowerShellGet
https://learn.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7
PowerShellGet is an in-box module in the following releases Windows 10
or newer Windows Server 2016 or newer Windows Management Framework
(WMF) 5.0 or newer PowerShell 6
Set your security level in your PowerShell session.
# Required for use with web SSL sites
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
If your ExecutionPolicy is set to AllSigned, then any script you run must be signed. Otherwise, set the ExecutionPolicy to RemoteSigned or ByPass in your user session.
How to Install Chocolatey using PowerShell
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (
(New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
)
i believe the title is self explanatory.
The install-module isn't working anymore. I had it running earlier, but after downloading NuGet through powershell the module doesn't work anymore at all, giving me the error message shown in the title.
I'm running on Windows 10, Powershell Ver.: 5.1.16299.15.
The question has been asked before, but on other threads the problem was the Powershell version, which isn't the case for me.
Gotcha! - From above discussions,
Did you change $env:PSModulePath ? Nuget installation would not change it. You can add C:\Program Files\WindowsPowerShell\Modules in the list and try.
$env:PSModulePath += ';C:\Program Files\WindowsPowerShell\Modules'
I am using Visual Studio Team Services (VSTS) hosted build agents in my build process. My builds mostly rely on the 'PowerShell' step that calls a script that I have in git. From within this script, I would like to manage PowerShell modules using PowerShellGet. For example, I would like to be able to install pscx simply by running
Install-Module -Name pscx
Unfortunately, hosted agents use PowerShell 4 and they don't have the PowerShellGet module installed. As a result, the Install-Module function is not available.
Anybody has any suggestion to use the PowerShellGet module on VSTS hosted agent? Note that since I don't have admin rights on this machine, I can't install the msi that installs PowerShellGet for PowerShell 4.
To be able to use PowerShellGet, two PowerShell modules are required:
PowerShellGet
PackageManagement
These are available out of the box with PowerShell 5 or through the msi installer available on the PowerShell Gallery.
Instead of deploying these modules through the msi, you can simply add them to your git repository (ex: in a folder named PsModules). You will be able to get a hand on these modules on a machine that has either PS5 or the msi installed. They are usually in the C:\Program Files\WindowsPowerShell\Modules folder.
Then, add the PsModules folders to your PSModulePath environment variable. Starting from there, it is possible to use PowerShellGet as in the following:
$env:PSModulePath = "$env:BUILD_SOURCESDIRECTORY\PsModules;$env:PSModulePath"
Import-Module PowerShellGet
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope currentuser
Save-Module pscx -path "$env:BUILD_SOURCESDIRECTORY\PsModules"
import-module pscx
Write-Host '************************'
Get-Command -module pscx
I'm running Windows 7 with PowerShell 2 installed.
I've downloaded version 2.1 from here - http://pscx.codeplex.com/releases
The Release notes say
unblock the zip file - {which I did}
extract the contents of the ZIP file to your $env:Home\Documents\WindowsPowerShell\Modules folder
I was unsure what $env:Home was so a bit of searching determined that the release notes are expecting an environment variable called Home which doesn't exist on my machine.
A bit more searching says use what is defined as ~ on my machine. So in a PS prompt I run cd ~
Which on my machine led to a network drive U:
I created the following directories U:\Documents\WindowsPowerShell\Modules and copied the extracted Pscx-2.1.0 to the Modules folder. Opened a PowerShell prompt and typed Get-Module -ListAvailable. This didn't give me Pscx in the results.
The above steps actually gave me this folder tree U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\Pscx-2.1.0
So I copied the files up a level and tried again with U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\ and also tried with U:\Documents\WindowsPowerShell\Modules\Pscx\
I also tried all of the above with this path U:\WindowsPowerShell\Modules\Pscx-2.1.0\
I'm guessing that the Modules aren't actually supposed to be in this directory, so a bit more searching leads to this command. (Get-ChildItem Env:\PSModulePath).Value
which gives the following result
C:\Users\my.name\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
So I copy the Pscx-2.1.0 folder to here C:\Users\my.name\Documents\WindowsPowerShell\Modules\Pscx-2.1.0
And still no luck.
What step am I missing?
I hadn't actually completed the last step of my above question completely which turned out to be the answer.
Here is that answer for completeness
Unblock the zip file you have downloaded
extract the zip file - this will likely give a folder structure of Pscx-2.1.0/Pscx-2.1.0/{lots of files}
rename the child folder to Pscx - ie - Pscx-2.1.0/Pscx/{lots of files}
In Powershell prompt run (Get-ChildItem Env:\PSModulePath).Value and note the modules folder location.
Copy the child Pscx folder to the Modules folder location given above.
In Powershell prompt run Get-Module -ListAvailable to see the Pscx module available.
In PowerShell 5.0, you can do:
Find-Package pscx | ? ProviderName -eq PSModule | Install-Package -Force
The -Force parameter will cause it to upgrade if an older version is already installed.
In PowerShell 5.1, you'll need:
Find-Package pscx | ? ProviderName -eq PowerShellGet | Install-Package -Force
or
Find-Package pscx -ProviderName PowerShellGet | Install-Package -Force
or just
Install-Package pscx -Force
Just run
choco install pscx
See chocolatey.org for a one-liner to get the choco command.
Keep in mind you may still have to call this in your scripts before running their commands:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #allows scripts to run from the interwebs, such as pcsx
Update: Looks like PsGet is no longer maintained, but source is still available on github.
You can also use PsGet to easily search and install PowerShell modules.
You can check which modules have been added to PsGet by browsing for all modules:
> Get-PsGetModuleInfo *
Or locate this one specfically:
> Get-PsGetModuleInfo pscx
Then you can install based on that information:
> Install-Module pscx
After spending lot of time searching here and there, i found this blog has very clear steps to solve. try it may helps u ..
http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/18/install-the-pscx-and-80-new-cmdlets-to-ease-powershell-use.aspx