I apologize if this is a NOOB question but I wrote a PowerShell script on my windows 10 box and I am trying to run the script on a 2008 box. On the new install of the 2008 box I had to add the windows powershell feature. My end goal is to install the Web Server (IIS) Administration Cmdlets
PS C:\Users\Administrator> Get-Module -ListAvailable | Import-Module
PS C:\Users\Administrator> Get-Module -ListAvailable
ModuleType Name ExportedCommands
---------- ---- ----------------
Manifest BitsTransfer {}
Manifest PSDiagnostics {Enable-PSTrace, Enable-WSManTrace, Start-Trace, Disable-PSWSManCombined...
PS C:\Users\Administrator>
PS C:\Users\Administrator> add-pssnapin WebAdministration
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
At line:1 char:13
+ add-pssnapin <<<< WebAdministration
+ CategoryInfo : InvalidArgument: (WebAdministration:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
PS C:\Users\Administrator>
PS C:\Users\Administrator> Import-Module WebAdministration
Import-Module : The specified module 'WebAdministration' was not loaded because no valid module file was found in any module directory.
At line:1 char:14
+ Import-Module <<<< WebAdministration
+ CategoryInfo : ResourceUnavailable: (WebAdministration:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId :Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Any ideas?
You need to install the IIS managment tools before the WebAdministration-module is available. Try (tested on Win10):
Enable-WindowsOptionalFeature -Online -FeatureName "IIS-WebServerManagementTools" -All
Windows Server 2008 doesn't come with a PowerShell module for managing IIS. That feature was added with Windows Server 2008 R2. You need to download and install it first. See here for further information. See also this related question.
Related
After the recent Windows 10 update my powershell scripts that use the cloudberry snapin are no longer working. I've re-installed cloudberry already with no success.
Even though the snapin is showing as registered:
PS C:\> Get-PSsnapin -Registered
Name : CloudBerryLab.Explorer.PSSnapIn
PSVersion : 2.0
Description : CloudBerry Explorer snap-in for PowerShell
Powershell can't recognize the command:
PS C:\> $destination = Get-CloudFilesystemConnection | Select-CloudFolder
"\\diskstation\drive1\backups\ow-data\"
Get-CloudFilesystemConnection : The term 'Get-CloudFilesystemConnection' is
not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the
path is correct and try again.
At line:1 char:16
+ $destination = Get-CloudFilesystemConnection | Select-CloudFolder "\\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-
CloudFilesystemConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The snapin is also being added to the current session but still doesn't show:
PS C:\> Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn
PS C:\> Get-PSsnapin
Name : Microsoft.PowerShell.Core
PSVersion : 5.1.17134.81
Description : This Windows PowerShell snap-in contains cmdlets used to
manage components of Windows PowerShell.
Ended up doing a re-pave (via "reset") to Win10 and spent the day reinstalling apps. The first app to install after the reset was Cloudberry and the plugin worked fine. The O/S was admittedly a bit old in the teeth having been upgraded from 7 a couple years ago. Thanks for your help attempts.
I'd like to use functionality from the latest Azure Powershell library but I'm struggling to install it. This is on an AWS x64 Windows 2012 R2 Standard server.
I get the following error
PS C:\Users\Administrator> Install-Module -Name AzureAD
WARNING: Cannot find an overload for "SoftwareIdentity" and the argument count: "17".
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'AzureAD'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\PSModule.psm1:1809 char:21
+ $null = PackageManagement\Install-Package #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
This is with PSVersion = 4.0
Get-Module shows: 3.1.0.0 Microsoft.PowerShell.Management, 3.1.0.0 Microsoft.PowerShell.Utility Script, 1.1.1.0 PackageManagement Script, 1.1.2.0 PowerShellGet
Get-PSRepository shows PSGallery Untrusted https://www.powershellgallery.com/api/v2/
Do you have any pointers to help troubleshoot / fix please?
Thanks
Ok so I installed Win8.1AndW2K12R2-KB3134758-x64.msu from https://www.microsoft.com/en-us/download/details.aspx?id=50395
Now Get-Module returns nothing and the first time I tried Install-Module -Name AzureAD it moaned about the -Name parameter. Second time (which I'm assuming means I'm imagining the first time) it worked. Now to see if I can add a user to an Azure AD group using the latest OpenICF connector scripts.
I am trying to install psget on windows 10 from powershell in admin mode but I get:
PS C:\Windows\system32> (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1
Invoke-WebRequest : The given path's format is not supported.
At line:42 char:13
+ Invoke-WebRequest -Uri $Url -OutFile $SaveToLocation
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Import-Module : The specified module 'C:\Users\myuser\Documents\WindowsPowerShell\Modules C:\Users\myuser\Documents\WindowsPowerShell\Modules\PsGet' was not loaded
because no valid module file was found in any module directory.
At line:105 char:9
+ Import-Module -Name $Destination\PsGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\myuser\Do...l\Modules\PsGet:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PsGet is installed and ready to use
USAGE:
PS> import-module PsGet
PS> install-module PsUrl
For more details:
get-help install-module
Or visit http://psget.net
PS C:\Windows\system32>
As suggested below PsGet is actually already installed on windows 10. I have then continued with the next step:
and as can be seen it installs successfully (needs to be done running as administrator). After a restart of the powershell console I still don't get any color highlighting though:
Any ideas?
Btw: the folder C:\Users[my-user]\Documents\WindowsPowerShell\Modules is empty:
Um... psget as in PowerShellGet module that I am almost certain comes on Win 10. I believe your error is even telling you that. Where it says PsGet is installed and ready to use.
Looks like the script at http://psget.net/GetPsGet.ps1 tries to decide where to install by querying for #($env:PSModulePath -split ';') and then limit the search for paths under Documents\WindowsPowerShell\Modules.
It appears that in your computer, PSModulePath includes twice the folder C:\Users\myuser\Documents\WindowsPowerShell\Modules, which causes an issue with the installation script.
You can do either one of these two options to solve it:
Remove one instance of C:\Users\myuser\Documents\WindowsPowerShell\Modules from the PSModulePath variable.
Install PsGet manually using the instructions in the official website.
After installing the 7zip4PowerShell module, if I call Get-Help on any of its cmdlets, I get the message
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
-- To download and install Help files for the module that includes this cmdlet, use Update-Help.
If I call update-help by itself, it doesn't change anything.
If I call update-help -Module 7zip4PowerShell, I get the following:
PS C:\windows\system32> update-help -Module 7zip4PowerShell
update-help : Failed to update Help for the module(s) :
'7Zip4Powershell'
The HelpInfoURI https://github.com/thoemmi/7Zip4Powershell does not start with HTTP.
At line:1 char:1
+ update-help -Module 7zip4PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (HelpInfoUri:Uri) [Update-Help], Exception
+ FullyQualifiedErrorId : InvalidHelpInfoUriFormat,Microsoft.PowerShell.Commands.UpdateHelpCommand
What am I doing wrong?
Windows Server 2008 R2 Datacenter on EC2
I tried following this guide to deploy NFS
PS C:\Users\Administrator\Downloads> Import-Module ServerManager
PS C:\Users\Administrator\Downloads> Add-WindowsFeature FS-NFS-Services
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No NoChan... {}
PS C:\Users\Administrator\Downloads> Import-Module NFS
Import-Module : The specified module 'NFS' was not loaded because no valid module file was found in any module
directory.
At line:1 char:1
+ Import-Module NFS
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (NFS:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
How can I get this cmdlet installed?