kuzum
asked on
remote powershell script
Dear Experts,
I have windows 10 enterprise edition and my users are on win7.
I need to run PowerShell command on few specific workstations to enable windows feature remotely so that I do not need to do floor walking for each machine.
Could someone please validate this script;
Invoke-Command -ComputerName 10.0.0.22, 10.0.0.23, 10.0.0.24 -ScriptBlock { Enable-WindowsOptionalFeat ure -online -FeatureName "ServicesForNFS-ClientOnly " } -credential my username
thank you
I have windows 10 enterprise edition and my users are on win7.
I need to run PowerShell command on few specific workstations to enable windows feature remotely so that I do not need to do floor walking for each machine.
Could someone please validate this script;
Invoke-Command -ComputerName 10.0.0.22, 10.0.0.23, 10.0.0.24 -ScriptBlock { Enable-WindowsOptionalFeat
thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think you it is a typo error as I passed this stage by Foreach ($Computer in $Computers)
I am having another issue with it wondering if you could help please.
[10.x.x.x] Connecting to remote server 10.215.235.14 failed with the following error message : The WinRM client cannot process
the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the
destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that
computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following
command: winrm help config. For more information, see the about_Remote_Troubleshooti ng Help topic.
+ CategoryInfo : OpenError: (10.215.235.14:String) [], PSRemotingTransportExcepti on
+ FullyQualifiedErrorId : CannotUseIPAddress,PSSessi onStateBro ken
I am having another issue with it wondering if you could help please.
[10.x.x.x] Connecting to remote server 10.215.235.14 failed with the following error message : The WinRM client cannot process
the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the
destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that
computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following
command: winrm help config. For more information, see the about_Remote_Troubleshooti
+ CategoryInfo : OpenError: (10.215.235.14:String) [], PSRemotingTransportExcepti
+ FullyQualifiedErrorId : CannotUseIPAddress,PSSessi
ASKER
Hi Ben,
apologies for multiple threads, it seems issue was caused by IP address and not using the hostname. I managed to resolve it by
using the hostname and now ended with this
Error: 50
The operation is complete but ClientForNFS-Infrastructur e feature was not enabled.
A required parent feature may not be enabled. You can use the /enable-feature /all option to automatically enable each parent feature
from the following list. If the parent feature(s) are already enabled, refer to the log file for further diagnostics.
ServicesForNFS-ClientOnly
The DISM log file can be found at C:\WINDOWS\Logs\DISM\dism. log
apologies for multiple threads, it seems issue was caused by IP address and not using the hostname. I managed to resolve it by
using the hostname and now ended with this
Error: 50
The operation is complete but ClientForNFS-Infrastructur
A required parent feature may not be enabled. You can use the /enable-feature /all option to automatically enable each parent feature
from the following list. If the parent feature(s) are already enabled, refer to the log file for further diagnostics.
ServicesForNFS-ClientOnly
The DISM log file can be found at C:\WINDOWS\Logs\DISM\dism.
ASKER
Hi Ben,
after few hours of troubleshooting I manage to get this script partially working. It does now tick the box but it leaves the sub box expty. How do I force it to select the box I need?
I attached the screenshot and this is where I am now.
thanks
after few hours of troubleshooting I manage to get this script partially working. It does now tick the box but it leaves the sub box expty. How do I force it to select the box I need?
I attached the screenshot and this is where I am now.
thanks
ASKER
with attachment
Capture.PNG
Capture.PNG
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks Ben, it was helpful.
Glad to help, sorry I missed your messages, last night we welcomed our second child into the world. :)
ASKER
thanks for your time. I just had a chance to test this and had below error?
At line:8 char:8
+ Foreach $Computer in $Computers {
+ ~
Missing opening '(' after keyword 'foreach'.
At line:8 char:19
+ Foreach $Computer in $Computers {
+ ~~
Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : MissingOpenParenthesisAfte