1
Vote

PowerShell Error

description

Hi,
 
I enabled powershell remoting on wfe and apps servers by doing this in pwoerpoint powershell:
enable-psremoting -force
 
I then ran the reset on my first WFE. Keep getting an error (no difference if ran from windows PS or Sharepoint PS).. Same error is given:

 

 
PS C:> ./reset.ps1
Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.SharePoint.Power
Shell because it is already added. Verify the name of the snap-in and try again
.
At C:\Reset.ps1:1 char:13
  • Add-PSSnapin <<<< Microsoft.SharePoint.PowerShell
    • CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShel
      l:String) [Add-PSSnapin], PSArgumentException
    • FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
      dPSSnapinCommand
       
      This script will reset the SharePoint config cache on all farm servers:
       
      Press enter to start.
       
       
      Invoke-Command : Cannot validate argument on parameter 'ComputerName'. The argu
      ment is null or empty. Supply an argument that is not null or empty and then tr
      y the command again.
      At C:\Reset.ps1:7 char:29
  • Invoke-Command -ComputerName <<<< $Servers -ScriptBlock {
    • CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBind
      ingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
      Shell.Commands.InvokeCommandCommand
       
      PS C:>

 

 
Thank you for your help.

comments

krill123 wrote Jul 16, 2012 at 3:19 PM

May not be related to the script. My lab test farm seems to have a weird issue...
Found that get-spserver command is giving nothing.

PS C:> get-spserver
PS C:>

Fyi.

krill123 wrote Jul 16, 2012 at 3:29 PM

Disregard issue.. I was logged into server as an admin account that didn't have farm administrator rights.

It's working now..

PS C:> ./reset.ps1
Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.SharePoint.Power
Shell because it is already added. Verify the name of the snap-in and try again
.
At C:\reset.ps1:1 char:13
  • Add-PSSnapin <<<< Microsoft.SharePoint.PowerShell
    • CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShel
      l:String) [Add-PSSnapin], PSArgumentException
    • FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
      dPSSnapinCommand
This script will reset the SharePoint config cache on all farm servers:
V41SPAPPSL01-L
V41SPWEBL01-L
V41SPWEBL02-L
Press enter to start.


V41SPWEBL01-L - Stopping timer service
V41SPWEBL01-L - Clearing cache folder C:\ProgramData\Microsoft\SharePoint\Config
\4e1d909c-1e61-4580-a669-0eab9e430aca
V41SPWEBL02-L - Stopping timer service
V41SPWEBL02-L - Clearing cache folder C:\ProgramData\Microsoft\SharePoint\Config
\4e1d909c-1e61-4580-a669-0eab9e430aca
V41SPAPPSL01-L - Stopping timer service
V41SPAPPSL01-L - Clearing cache folder C:\ProgramData\Microsoft\SharePoint\Confi
g\4e1d909c-1e61-4580-a669-0eab9e430aca
V41SPWEBL01-L - Resetting cache ini file
V41SPWEBL01-L - Starting timer service
V41SPAPPSL01-L - Resetting cache ini file
V41SPAPPSL01-L - Starting timer service
V41SPWEBL02-L - Resetting cache ini file
V41SPWEBL02-L - Starting timer service
PS C:>

wrote Feb 13, 2013 at 6:44 PM