Tuesday, March 13, 2012

How to run script sharepoint on powershell

Open Windows PowerShell ISE then paste segment code Get-SPSite to Command pane up  (View > Go to Command Pane)  as follows:

You see error because local user PowerShell ISE profile doesn’t create
Copy segment code and paste to Command pane up (View > Go to Command Pane) as follows:
# Creates a local user PowerShell ISE profile
if (!(test-path $profile ))
{new-item -type file -path $profile -force}
# opens it for edit
psEdit $profile
Completed
Save it (click to Icon Save)
Close and Open Again
Paste segment code “Get-SPSite” to Command pane up  (View > Go to Command Pane)  as follows:
Script run succeeded
You can copy “Get-SPSite” and paste to Script Pane (View -> Script Pane) then click “Run Script” Icon
Result as follows:
Save script
Exit ISE
Start ISE then open file .ps1
Choose your file
UI as follows
Result as follows:

0 comments:

Post a Comment