Darrin Bishop

From the Workbench
posts - 106, comments - 17, trackbacks - 6

Barcelona, Spain PowerShell/SharePoint Scripts

As promised here are the PowerShell scripts I used in my session at ITForums in Barcelona Spain. 

 PS_SPDemoCode.zip

If you want to follow along with the demo script  (demoScript.txt)  you must place the files in the correct location or change the included demo script.  Once the files are placed in the correct location on the SharePoint server  you can copy  and paste the commands from demoScript.txt to PowerShell.

To setup the environment to follow the demoScript.txt:

1)  Copy DBGDesignLinks to the SharePoint server's  feature folder  (12\Template\Feature). This simple feature will add two links to the Site Actions menu to access the Features management page.

2)  Copy the code located in the Microsoft.PowerShell_profile.ps1  file to your profile.ps1 file. To locate your profile simply type in $profile at the PowerShell prompt.  The  Microsoft.PowerShell_profile.ps1 file  contains some basic functions such as AddFeatureToWeb,  RemoveFeatureToWeb  as well as loading the SharePoint assembly and creating  PSDrives. You will need to exit and restart PowerShell so PowerShell will load up the functions in the profile.

3)  Copy the files located in the PSScripts folder to C:\ PSScripts.   These script files are used in the demoScript.txt file to Create and Delete sub webs. There is also txt file that contains the information about the sub webs that will be created.


Once done,  you can copy the commands from the demo script to recreate the demo. The basic demo will:

  • Install a feature
  • Create  sub sites from a configuration file
  • Add the feature to the sub sites
  • Find the sub sites with the feature
  • Remove the feature from the sub site
  • Delete the sites
  • Uninstall the feature.
     
Check back soon for a few more simple but powerfull PowerShell functions and filters that can be easily chained togehter to provide basic access to key SharePoint objects.

Print | posted on Friday, November 23, 2007 8:18 PM | Filed Under [ PowerShell SharePoint ]

Feedback

Gravatar

# re: Barcelona, Spain PowerShell/SharePoint Scripts

Hi Darrin,

Thanks for posting these. I was checking your web site regularly since Barcelona as I really enjoyed your presentation and the examples.
Cheers

Niels
11/26/2007 2:32 AM | Niels Immink

# re: Barcelona, Spain PowerShell/SharePoint Scripts

Thanks for the comment Niels. Please let me know if you have any issues witht he scripts. I packaged them up late one night.

Also watch for a few more PowerShell and SharePoint posts this week.
11/26/2007 5:19 AM | Darrin Bishop
Comments have been closed on this topic.

Powered by: