______________________________________________________________________________
This blog has been discontinued. Please visit my new site based on a completely different concept:
Sharepoint Resource Center
______________________________________________________________________________
As I mentioned yesterday I’ve decided to give blogging another chance. I’ve also decided I’d try posting relatively often by simply blogging about the different Sharepoint issues I run into everyday. Issues small and big. Most often small ones that nonetheless take quite a bit of time. An example of such an issue today:
Scenario:
We’ve got a top-level site called “Clients” which, in turn, contains over 170+ individual client sites. I sometimes need to perform an operation on each and every client site. I obviously try to automate things as much as possible. Very often I can achieve my goal using stsadm or one of the great Gary Lapointe’s STSADM extentions. I’ll write the command and use a batch file that reads through the list of client sites and executes the command for each file.
Problem:
New client sites are added on a daily basis – how do I get a list of all client sub-sites so I can use it with my batch file?
Solution:
1) Use the stsadm –o enumsubwebs command to list all subsites and export the output to a .csv file.
STSADM.EXE” -o enumsubwebs -url http://vit-intranet/clients >d:\clients.csv
2) Open the clients.csv file in excel
You’ll find that the stsadm output is formatted as follows
<Subweb>http://vit-intranet/clients/ABW</Subweb>
<Subweb>http://vit-intranet/clients/ACL</Subweb>
<Subweb>http://vit-intranet/clients/AGI</Subweb>
<Subweb>http://vit-intranet/clients/AGT</Subweb>
<Subweb>http://vit-intranet/clients/AKC</Subweb>
<Subweb>http://vit-intranet/clients/ALP</Subweb>
<Subweb>http://vit-intranet/clients/ALT</Subweb>
<Subweb>http://vit-intranet/clients/ASH</Subweb>
Obviously, in order to use a list of my sites in a batch file I need to get rid of the leading and trailing <subweb> strings
3) Parse the client sites paths
Here are the steps:
a) Select the column containing the exported site paths
b) Switch to Data tab (Excel 2007) or open the Data menu (earlier versions of excel)
c) Choose “Text To Columns”, this launches the Covert Text to Columns Wizard
d) Choose the Delimited option on the fist page of the wizard, click Next
e) In the Delimiters section select “Other” and type in ” > ” (no quotes), click Finish
f) Repeat the steps for the “<” delimeter.
You now have a nicely formatted list of your subsites you can feed directly to a batch file.
Filed under: Uncategorized

