Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

POWERSHELL NOT working, but the result is saying OK

$
0
0

Hi

I have a problem, the problem is that I am running a PowerShell script:

$server

 

 

=get-ADComputer-Filter'Name -like "serv*"' | select name

$server

 

 

| ForEach-Object { Enter-PSSession-ComputerName$_.name import-module servermanager get-WindowsFeature XPS-Viewer Exit-PSSession }

And I'm getting the result of:

 

Success Restart Needed Exit Code Feature Result

------- -------------- --------- --------------

True No NoChan... {} (that's because I have run it several times) but the initial was "true" "no" and "successful"

when I run get-windowsfeature xps-viewer, I get this:

 

Display Name Name

------------ ----

[X] XPS Viewer XPS-Viewer

That means that xps is installed, BUT IT IS NOT INSTALLED!!!

If I run pssession directly to the server(in powershell window)(001->) it works! see further:

"PS C:\Windows\system32> enter-pssession -computername server071"

[server071]: PS C:\Users\4x\Documents> import-module servermanager
[server071]: PS C:\Users\4x\Documents> get-windowsfeature xps-viewer

Display Name                                            Name
------------                                            ----
[ ] XPS Viewer                                          XPS-Viewer

Its not installed!!

now I run from powershell:

[server071]: PS C:\Users\4x\Documents> add-windowsfeature xps-viewer

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {XPS Viewer}

WHAT AM I DOING WRONG? It seems hopeless, I have about 500+ servers, and doing this manual is not an option! I have done variations, like just using 1 server name, but the result is the same. no installation, but the result says "ok, done" no error, BUT IT HAS NOT INSTALLED!!

Please I need some advice here... HELP!!!!

 PS: Running from POWERGUI in ADMIN mode..

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles