Thursday 17 September 2015

Powershell

Pre-Req .Net 4.0 Framework full
http://www.microsoft.com/en-GB/download/details.aspx?id=17851

Download PowerShell V3
http://www.microsoft.com/en-us/download/details.aspx?id=34595


Enable Remoting

To connect to a different machine (or local) and use that's feature e.g. I am logged on to Machine A (my deb box) (no SharePoint installed) and Machine B got SharePoint stuff and I got a task to write PowerShell script add x,y and z user to SharePoint site. The solution is use to remoting instead of logging on to Machine B.


On Machine B write following command
Enable-PSRemoting -Force

On Machine A write following command

Enter-PSSession -ComputerName MachineB -Credential (Get-Credential <domain>/<username>)

now enter SharePoint related command from with in MacihneB like it got SharePoint installed (the commands are executed on remote machine, and PowerShell gets the response with similar objects to work against gets attributes with data but not methods)

No comments:

Post a Comment