Avatar of Grumpy_Old_Man
Grumpy_Old_ManFlag for United Kingdom of Great Britain and Northern Ireland asked on

Powershell loop question

Hi,
I am currently running the following powershell command to restore a number of sites.

stsadm -o restore -url http://30242/training/dept11 -filename c:\1\budept.bak -overwrite

I have 11 sites called dept1, dept2, dept3 ... dept11. How do a edit this script to automatically loop thoughand restore all 11 sites instead of running 11 separate commands?

Thanks.
Gary
ProgrammingMicrosoft SharePointPowershell

Avatar of undefined
Last Comment
Grumpy_Old_Man

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Chris Dent

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Grumpy_Old_Man

Thanks Chris, that perfect. The sites are sequential, I just have no idea about powershell as yet, but learning :-)

Regards
gary
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck