It can be very time consuming in the SharePoint browser UI to delete a large structure of sub-sites below a particular site. This is because you are unable to delete a site that contains other sub-sites without deleting those sub-sites first, which in turn may contain other sub-sites!
The PowerShell script below allows you to choose a start site (i.e., the site from which you want to delete all sub-sites), walks through each sub-site and deletes it, starting from sites at the end of the hierarchy and working backwards until it returns back to the start site, which it will not delete.
First, run the PowerShell script below – Note: Doing this will not start deleting sites as you have to call the functions in the script with a separate command (see below).
function Delete-SPSubSites ($StartSite)
{
Start-SPAssignment –Global
#Get the starting site from which to delete all sub-sites
$web = Get-SPWeb $StartSite
#Run function to get all sub-sites below the start site
Get-SPSubWebs -StartWeb $web
Stop-SPAssignment –Global
}function Get-SPSubWebs ($StartWeb)
{
#Get all sub-sites below the start site
$webs = $StartWeb.GetSubwebsForCurrentUser()
#Run this routine if there are sub-sites present
if ($webs.Count -gt 0)
{
#Walk through each sub-site
foreach ($nextWeb in $webs)
{
#Check for sub-sites underneath this site
Get-SPSubWebs -StartWeb $nextWeb
#Run function to delete the site
Delete-SPSubWeb -DeleteWeb $nextWeb
$nextWeb.Dispose()
}
}
}function Delete-SPSubWeb ($DeleteWeb)
{
#Delete the site specified in the $DeleteWeb variable
write-host "Deleting site"$DeleteWeb.Title"at"$DeleteWeb.Url
$DeleteWeb.Delete()
$DeleteWeb.Dispose()
}
Once you have run the script, you can use it to delete sub-sites by typing the following command in the PowerShell console:
Delete-SPSubSites -StartSite http://portal/team
The example above will delete all sub-sites below http://portal/team, but will not delete the http://portal/team site itself.
In case it’s not obvious (!), be very careful with the use of this script. Take a backup of your site collection first, and run on a development server before using this script in a live environment to ensure you delete the correct sites.
Can you run this from the Sharepoint Management Console? Powershell isn't recognizing the function Delete-SPSubSites even though I can successfully execute the script before trying to call it using the final instruction of your post. Any thoughts?
ReplyDeleteError Received:
The term 'Delete-SPSubSites' is not recognized as the name of a cmdlet, functio
n, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At line:1 char:18
+ Delete-SPSubSites <<<< -StartSite http://siteurl + CategoryInfo : ObjectNotFound: (Delete-SPSubSites:String) [], C
ommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in Chennai For CSE provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.
DeleteThis is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.
The same error here...
ReplyDeleteYou have to put the script in the standard library or you need to prefix the script with the directory name as in the picture
ReplyDelete2015-12-7 xiaozhengm
ReplyDeleteugg boots
hollisters
michael kors handbags
nike free runs
sac longchamp pas cher
christian louboutin outlet
true religion
gucci borse
fitflop uk
christian louboutin
michael kors
michael kors outlet
ralph lauren uk
cheap uggs on sale
barbour uk
jordan 4
juicy couture
jordan 6
michael kors outlet
ed hardy outlet
ralph lauren pas cher
nike shoes
gucci outlet
ray ban sunglasses
michael kors outlet online
coach factory outlet
christian louboutin outlet
mizuno running shoes
oakley vault
nike roshe run women
cheap jordans
ugg boots
coach outlet
michael kors
nike outlet store
michael kors outlet online
coach outlet
jordan 13
pandora charms
coach outlet
Nice article..
ReplyDeleteOnline DotNet Training
.Net Online Training
Dot Net Training in Chennai
gucci sunglasses uk
ReplyDeletelongchamp pliage
nike air force 1
longchamp handbags
football shirts
tory burch outlet online
cartier watches
jordan pas cher
oakley sunglasses
cheap soccer jerseys
chrome hearts outlet
ralph lauren polo
hermes outlet
true religion jeans
versace sunglasses on sale
michael kors outlet online
ray ban sunglasses
fitflops clearance
rolex watches
cartier outlet store
prada sneakers
chrome hearts outlet
rolex watches
cheap jordans
ralph lauren outlet
tiffany and co
louis vuitton outlet store
ferragamo shoes
polo ralph lauren
dior outlet
cai20160519
Online gaming is a hobby of many people. Game Run Unblockedversions as Run 3 Unblocked or Run 4 Unblocked is a very interesting game to control the bear run or jump to the safe landing area falls. risks with such racing game Car Racing Games or interesting as the game Donkey Kong Unblocked or Car Racing Games wrap pulled a lot of players. Good luck!
ReplyDeletelouis vuitton
ReplyDeletecoach factory outlet
ray ban sunglasses outlet
coach factory outlet
rolex submariner watches
louis vuitton handbags
louis vuitton outlet
toms outlet
jordans
ray ban sunglasses
ralph lauren polo
cartier watches
oakley sunglasses
rolex watches
louis vuitton handbags
pandora jewelry
ralph lauren uk
true religion jeans
ray ban sunglasses
burberry outlet
jordan 3 infrared
cheap jordans
michael kors handbags
fitflops
coach outlet online
cheap ray ban sunglasses
abercrombie outlet
louis vuitton outlet
basketball shoes
jordan shoes
longchamp handbags
michael kors handbags
true religion outlet
burberry outlet online
michael kors handbags
adidas trainers
adidas originals
abercrombie and fitch
adidas outlet
tods shoes
20168.8wengdongdong
abercrombie and fitch
ReplyDeletecavaliers jerseys
coach outlet
coach handbags
uggs outlet
louis vuitton outlet
louis vuitton handbags
louis vuitton outlet
ralph lauren
ray ban pas cher
20173.9chenjinyan
true religion uk
ReplyDeletethunder jerseys
hollister co
nike air max 95
red bottom
toms
michael kors bags
nike roshe one
air max
coach factory outlet
0324shizhong
fitflop sandals
ReplyDeletecheap michael kors handbags
converse outlet store
ray ban sunglasses
snapback hats
michael kors bags
louboutin outlet
birkenstock shoes
coach outlet store online clearances
adidas trainers
2017.5.15chenlixiang
pandora charms sale clearance
ReplyDeleteadidas nmd runner
coach outlet online
jimmy choo shoes
mlb jerseys
toms
air max
fitflops sale
gucci outlet online
polo ralph lauren outlet online
170517yueqin
Very nice article, thanks for sharing the information
ReplyDeleteObat Tradisional Gangguan Jantung
Obat Penyakit Kencing Manis
Obat Tumor Miom
Obat Osteoarthritis Tradisional
Obat TBC Anak
Obat Untuk Mengatasi ISPA
This information is very useful. thank you for sharing. and I will also share information about health through the website
ReplyDeleteObat gatal Kudis/gudik
Walatra Gamat Emas Kapsul
Vitamin Untuk Kesehatan Anak
Penyebab sering mimisan
Cara Mengatasi Cacar Air
Cara Menghilangkan Kantung mata
https://myserviceshome.com/surface-insulation-company-in-riyadh/
ReplyDeletehttps://myserviceshome.com/home-services-in-dammam/
https://myserviceshome.com/furniture-transfer-company-in-riyadh/
https://myserviceshome.com/insulation-of-riyadh-tanks/
https://myserviceshome.com/pesticide-spraying-company-in-riyadh/
Thank has been sharing this information
ReplyDeleteobat batu ginjal alami
obat anyag anyangan
obat lyimphadenitis
obat singkayo
https://ahbabelmadina.com/cleaning-company-dammam/
ReplyDeletehttps://ahbabelmadina.com/transfer-furniture-dammam/
https://ahbabelmadina.com/pest-cotrol-dammam/
https://ahbabelmadina.com/cleaning-tanks-in-dammam/
https://ahbabelmadina.com/sewage-company-of-dammam/
https://ahbabelmadina.com/شركة-نقل-عفش-بالدمام/
ReplyDeletehttps://ahbabelmadina.com/insulation-company-in-dammam/
https://ahbabelmadina.com/detection-of-water-leaks-in-dammam/
https://ahbabelmadina.com/installation-of-kitchens-in-dammam/
https://ahbabelmadina.com/central-gas-extension-company-in-dammam/
https://ahbabelmadina.com/carpenter-in-dammam/
ReplyDeletehttps://ahbabelmadina.com/buying-used-furniture-in-dammam/
https://ahbabelmadina.com/plumber-in-dammam/
https://ahbabelmadina.com/an-electrician-in-dammam/
https://ahbabelmadina.com/painter-in-dammam/
https://ahbabelmadina.com/anti-bugs-company-dammam/
ReplyDeletehttps://ahbabelmadina.com/anti-white-termite-company-dammam/
https://ahbabelmadina.com/rats-control-in-dammam/
https://ahbabelmadina.com/spraying-insects-company-dammam/
https://ahbabelmadina.com/pesticide-spraying-company-dammam/
También puede visitar una tienda de ladrillo y mortero de Michael Kors o su sitio web y comprar directamente un bolso Michael Kors desde allí. Usar un bolso de Michael Kors les permite a los demás reconocer que el habitante urbano educado toma la moda realmente con seriedad. Los bolsos de hombro son particularmente refinados y elegantes.
ReplyDelete{Bolsas Michael Kors Precios | Bolsos Michael Kors Outlet | Michael Kors Rebajas}
En vacker konstnärlig skapelse av vävt läder, som ger ett skalskaligt utseende - liknar en snakeskin eller fiskhud, linjer utsidan av påsen. Läderens bältros är små läderringar. Det finns också gyllene accenter på väskan. Slutresultatet är svagt liknar kedjepost.
{Michael Kors Rea | Michael Kors Väska Rea | Michael Kors Plånbok}
Thank you, the article is very petrifying
ReplyDeleteTips Paling Ampuh Untuk Pengobatan Meningitis
Obat Herbal Radang Selaput Dada
Cara Mengobati Anyang-anyangan
مكافحة بق الفراش شرق الرياض
ReplyDeleteتخزين اثاث بالدمام
شركة تخزين عفش بالخرج
شركة كشف تسربات المياه خصم 30%
شركة تسليك مجاري شمال الرياض
افضل اسعار شركة تنظيف خزانات بجدة
شركة تنظيف شقق بالرياض باسعار منافسة
شركة تنظيف فلل وقصور بالرياض
شركة تنظيف موكيت بالرياض
شركة تنظيف منازل بالخرج
شركة تنظيف منازل مجربة بالرياض
ReplyDeleteشركة تنظيف واجهات حجر بالرياض عمالة فلبينية
شركة تنظيف واجهات زجاج بالرياض مجربة
أفضل شركة رش مبيدات حشرية بالرياض
شركات نقل اثاث من الرياض الى الاردن
شراء الاثاث المستعمل شمال الرياض
شركة تنظيف بالخرج رخيصة
شركة صيانة مسابح بالرياض
شركات نقل اثاث وعفش بالخرج
شركة شفط بيارات بالخرج
أرخص شركة عزل اسطح بالرياض
ReplyDeleteشركة عزل خزانات بالرياض
شركة مكافحة حشرات بالخرج ممتازة
أفضل شركة مكافحة حشرات بالرياض
شركة مكافحة الصراصير بالرياض مع الضمان
شركة مكافحة الفئران بالرياض
خدمات تنظيف شاملة بالرياض باقل الاسعار
شركة نقل اثاث شرق الرياض
أسعار شركة نقل اثاث من الرياض الى الامارات
شركة نقل عفش بالرياض ممتازة
خدمات مكافحة النمل الابيض بالرياض بالضمان
ReplyDeleteاسعار تخزين الاثاث بالرياض
pest control service in ksa
floor cleaning company in jeddah
شركة رش مبيدات قبل البناء
أرخص شركة تنظيف بيوت شعر
شركة مكافحة الثعابين جنوب الرياض
افضل شركة تنظيف مدارس بالرياض
افضل شركة غسيل موكيت بالمدينة المنورة
مكافحة الباعوض بالرياض
شركة تنظيف مجالس بمكة
ReplyDeleteطبيب اسنان الشيخ زايد
دكتور اسنان شاطر في الشيخ زايد
دكتور تقويم اسنان الشيخ زايد
دكتور اسنان في كفر الشيخ
اشطر دكتور اسنان في كفر الشيخ
شقق مصيفية للايجار بجمصة
اسعار شقق مصيف جمصة 2017
شقق للبيع بجمصة 15 مايو
شركة تنظيف موكيت بجازان
شركة تنظيف منازل بجازان
ReplyDeleteشركة تنظيف مسابح بجازان
شركة رش دفان بالمجمعة
شركة رش دفان بالقويعية
شركة مكافحة النمل الابيض بالقصيم
شركة مكافحة النمل الابيض بالطائف
شركة مكافحة النمل الابيض بالرس
cheap nfl jerseys
ReplyDeletecheap jerseys
cheap jerseys from china
wholesale jerseys
cheap nfl jerseys from china
china jerseys
nfl jerseys china
wholesale nfl jerseys
cheap authentic nfl jerseys
cheap jerseys online
cheap authentic jerseys
cheap sports jerseys
cheap wholesale jerseys
china wholesale jerseys
discount nfl jerseys
cheap authentic jerseys from china
discount jerseys
custom cowboys jersey
nfl jerseys cheap
cheap nfl jerseys china
authentic nfl jerseys
تطهير المرحاض على نحو صحيح، والتخلّص من آثار البول والبراز. التأكّد من إقفال جميع خزّانات الاستبدال الصحي، والمصارف الأخرى. استعمال المواد العضوية تُعرف المواد العضوية على أنها المواد غير الكيميائية على العموم، ويشمل هذا استعمال رشاشات طبيعية مصنوعة منزلياً من الثوم، والفلفل، والبصل، والصابون، والملح وغيرها، واستخدام مواد مثل ماء الشعير للتخلص من الرخويات، ونمل الخشب، والديدان، والقوارض، والحشرات الأخرى، كما تعد المواد العضوية فعالة إلى حاجزٍ ما في الأنحاء الضئيلة مثل الحدائق المنزلية، بحيث تكون أعداد الحشرات هابطة نسبياً؛ فهي نادراً ما تكون مجدية أو فعالة على منطقة أضخم.
ReplyDeleteشركة مكافحة حشرات
شركة مكافحة النمل الابيض بخميس مشيط
شركة مكافحة حشرات بخميس مشيط
شركة رش مبيدات بخميس مشيط
شركة اللمسة الأخيرة تقدم لك الحل الأمثل فلا حشرات بعد اليوم ولن تعود مرة أخرى. فنحن نستخدم أفضل المبيدات العالمية الفعالة صديقة البيئة التي لا تترك رائحة ولا سيوثر على صحة الأنسان ويقوم باستخدامها عمال مدربون يقومون برش المبيدات بشكل علمي مما يضمن لك الراحة التامة نرجو التواصل على هذا الرقم 0580002467
ReplyDeleteشركة رش مبيدات بأبها
شركة مكافحة حشرات بأبها
شركة مكافحة النمل الابيض بأبها
شركة رش مبيدات بخميس مشيط
شركة مكافحة حشرات بخميس مشيط
شركة مكافحة النمل الابيض بخميس مشيط
شركة رش مبيدات بالقصيم
شركة مكافحة حشرات بالقصيم
شركة مكافحة حشرات بجازان
شركة رش مبيدات بجازان
شركة اللمسة الأخيرة تقدم لك الحل الأمثل فلا حشرات بعد اليوم ولن تعود مرة أخرى. فنحن نستخدم أفضل المبيدات العالمية الفعالة صديقة البيئة التي لا تترك رائحة ولا سيوثر على صحة الأنسان ويقوم باستخدامها عمال مدربون يقومون برش المبيدات بشكل علمي مما يضمن لك الراحة التامة نرجو التواصل على هذا الرقم 0580002467
ReplyDeleteشركة رش مبيدات بأبها
شركة مكافحة حشرات بأبها
شركة مكافحة النمل الابيض بأبها
شركة رش مبيدات بخميس مشيط
شركة مكافحة حشرات بخميس مشيط
شركة مكافحة النمل الابيض بخميس مشيط
شركة رش مبيدات بالقصيم
شركة مكافحة حشرات بالقصيم
شركة مكافحة حشرات بجازان
شركة رش مبيدات بجازان
شمول الخدمة: تقدم المؤسسة خدمة شاملة لعملاءها فمهما كان الضرر الذي أصاب موضع معيشتكم ومهما تعددت أشكال الحشرات أو القوارض فالشركة تتكفل بهم جميعاً في خدمة شاملة، مثلما أن خدماتها لا تقتصر على البيوت لاغير، وإنما نقدم خدماتنا في البيوت والفنادق والمؤسسات والشركات والمساجد والمطاعم وغيرهم.
ReplyDeleteافضل شركة مكافحة حشرات
شركة مكافحة النمل الابيض بالجبيل
شركة مكافحة حشرات بالجبيل
شركة رش مبيدات بالجبيل
شركة مكافحة حشرات بنجران
ReplyDeleteشركة مكافحة حشرات بجازان
شركة مكافحة حشرات بابها
شركة مكافحة حشرات بالقصيم
ReplyDeleteشركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج
شركة مكافحة حشرات بالقصيم
ReplyDeleteشركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج
شركة مكافحة حشرات بالقصيم
ReplyDeleteشركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج
شركة مكافحة حشرات بالدمام
ReplyDeleteشركة مكافحة حشرات بالطائف
شركة مكافحة حشرات بالرياض
هل تبحث عن شركة متخصصة فى خدمات التنظيف بالطائف بافضل المعدات والسوائل وثقة تمة فى العمل ودقة فى النتائج كل هذه المميزت توفرها شركة الخليج الشركة الافضل والامثل فى الخدمات المنزلية بالطائف وبما اننا الشركة الافضل والامثل بدون منافس سوف نسعى لتوفر افضل الخدمات باقل تكلفة وبقدر كبير من الاهتمام والدقة عزيزى اينما كنت فى اى منطقة ا وحى تابع لمدينة الطائف اتصل بنا وسوف نصلك فى الحال شركة الخليج للخدمات المنزلية شركة تنظيف منازل بالطائف
ReplyDeleteشركة تنظيف فلل بالطائف
شركة تنظيف خزانات بالطائف
شركة تسليك مجارى بالطائف
شركة رش مبيدات بالطائف
شركة مكافحة نمل ابيض بالطائف
شركة مكافحة حشرات بالطائف
شركة عزل اسطح بالطائف
شركة عزل خزانات بالطائف
هل تبحث عن شركة متخصصة فى خدمات التنظيف بالطائف بافضل المعدات والسوائل وثقة تمة فى العمل ودقة فى النتائج كل هذه المميزت توفرها شركة الخليج الشركة الافضل والامثل فى الخدمات المنزلية بالطائف وبما اننا الشركة الافضل والامثل بدون منافس سوف نسعى لتوفر افضل الخدمات باقل تكلفة وبقدر كبير من الاهتمام والدقة عزيزى اينما كنت فى اى منطقة ا وحى تابع لمدينة الطائف اتصل بنا وسوف نصلك فى الحال شركة الخليج للخدمات المنزلية شركة تنظيف منازل بالطائف
ReplyDeleteشركة تنظيف فلل بالطائف
شركة تنظيف خزانات بالطائف
شركة تسليك مجارى بالطائف
شركة رش مبيدات بالطائف
شركة مكافحة نمل ابيض بالطائف
شركة مكافحة حشرات بالطائف
شركة عزل اسطح بالطائف
شركة عزل خزانات بالطائف
A beautiful purse or handbag from Coach Outlet Online can last for many years, and represent a great overall value.
ReplyDeleteThere are Michael Kors Bags Outlet in a large number of shopping malls located throughout the country.
Cheap Michael Kors Bags is a great way to determine which models best suit your needs.
Official Coach Factory Outlet Online all strive to provide comfort and convenience for their owners and the seams are double-stitched for maximum durability.
Michael Kors Factory Store, has one of the most popular handbag and accessory lines on the market today.
Coach Handbags Wholesale says a lady is classy, elegant and sophisticated.
Coach Store Near Me trends come and go, but a Coach stands the test of time.
The official Michael Kors Handbags On Sale Outlet regularly posts various handbags being offered for sale.
Compare your Coach Bags On Sale Outlet to the logo provided on the website to make sure it is similar.
All Michael Kors Outlet Online Store have serial numbers.
No matter what type of Michael Kors Bags Outlet each individual got, they all had one thing in common. We all know that getting something on sale is like winning a mini lottery, but to find a name brand handbag like Michael Kors Black Friday Sale for instance, discounted is like a slice of heaven on earth. I have personally attacked my husband with hugs and kisses when finding Official Coach Outlet Online at discounted prices.
ReplyDeleteMichael Kors Factory Outlet stores can be found in malls all over. MK Outlet and other Coach merchandise can also be found in some boutiques. Inspired by the same material baseball gloves are made from, these Coach Bags On Sale Online are versatile and stylish. Since it's conception, the Michael Kors Handbags Outlet has been produced into a variety of designs, colors, shapes, and styles that have won top pick of millions of women the world over.
New Michael Kors Bags are the most sought after handbag. Since Coach Outlet Online is one of the most recognized name brands in the world of fashion, you will find A-list celebrities down to small girls wearing them.
tags:Coach Outlet|Coach Bags Factory Outlet|Coach Purses Outlet
هل تبحث عن شركة متخصصة فى خدمات التنظيف بالطائف بافضل المعدات والسوائل وثقة تمة فى العمل ودقة فى النتائج كل هذه المميزت توفرها شركة الخليج الشركة الافضل والامثل فى الخدمات المنزلية بالطائف وبما اننا الشركة الافضل والامثل بدون منافس سوف نسعى لتوفر افضل الخدمات باقل تكلفة وبقدر كبير من الاهتمام والدقة عزيزى اينما كنت فى اى منطقة ا وحى تابع لمدينة الطائف اتصل بنا وسوف نصلك فى الحال شركة الخليج للخدمات المنزلية شركة تنظيف منازل بالطائف
ReplyDeleteشركة تنظيف فلل بالطائف
شركة تنظيف خزانات بالطائف
شركة تسليك مجارى بالطائف
شركة رش مبيدات بالطائف
شركة مكافحة نمل ابيض بالطائف
شركة مكافحة حشرات بالطائف
شركة عزل اسطح بالطائف
شركة عزل خزانات بالطائف
Thanks for provide great informatic and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you once agian
ReplyDeleteBirth certificate in delhi
Birth certificate in ghaziabad
Birth certificate in gurgaon
Birth certificate in noida
How to get birth certificate in ghaziabad
how to get birth certificate in delhi
birth certificate agent in delhi
how to download birth certificate
birth certificate in greater noida
birth certificate agent in delhi
Birth certificate delhi
شركة مكافحة حشرات بالقصيم
ReplyDeleteشركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج