vinny579 Contributor.
Contributor.
1453 views

How to Run SharePoint Management Shell command Remotely

hi,

I want to run sharepoint management command on the target server. The commands basically checks Service Status and Restarts the service. Please help me out i this scenario. Guide what opearation i will have to use to execute these commands remotly on that target server.

Thanks,

Vinny-ooAutobot

Labels (1)
0 Likes
3 Replies
scuda20 Super Contributor.
Super Contributor.

Re: How to Run SharePoint Management Shell command Remotely

For just checking/start/stop services look in this path /Base [1.8.0]/Library/Operations/PowerShell/Services any addtional sharepoint commands you will need to create your flows and use powershell commands most likely or script it out, transfer and run.

Also research how to setup remote powershell Enable-PSRemoting -Force and wmi setup/config.

vinny579 Contributor.
Contributor.

Re: How to Run SharePoint Management Shell command Remotely

hey Thanxx buddy !!!

0 Likes
scuda20 Super Contributor.
Super Contributor.

Re: How to Run SharePoint Management Shell command Remotely

Like I said I don't know much about Sharepoint (other than I have workflowed it to install) but for things like exchange which need elevated privileges and your WRAS is outside the domain, I usually create a script locally, transfer it and then use RCE to run it. You are essentially telling PS to open a new PS session on the target to run like so

$user="${domainShort}\administrator"
$pass=ConvertTo-SecureString -String "${domainPassword}" -AsPlainText -Force
$cred=New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $user, $pass
$server="${dataIP}"
$r=new-pssession -computername $server -Authentication Credssp -credential $cred
invoke-command -session $r -scriptblock {C:\patch\exchange\setup.com /PrepareAD /OrganizationName:${domainShort}

Also, note there are certain requirements for some servers that simply can't be installed remotely. I can't recall the names of the patches/dll's, but if you research enough you will find that they can only be installed while physically logged in or with WSUS. For those you will need to pre-install in your template or base image.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.