locked
Power Shell Script for converting classic pages to modern RRS feed

  • Question

  • Hi Community, 

    We have more than 200 SharePoint sites and we cant to convert all the pages in every site to modern experience . We got a script from Microsoft site and it is working fine. But,the issue is we have to run it again and again for each sites. 

    If we store all the site names url in an excel page , can a Powers Shell script read the site names one by one do the convertion ?

    Below is the script we used . Any help is appreciated.  Thanks !!! 

    https://docs.microsoft.com/en-us/sharepoint/dev/transform/modernize-userinterface-site-pages-powershell


    • Edited by YAMA-APP Thursday, March 12, 2020 11:28 PM
    Thursday, March 12, 2020 11:13 PM

Answers

  • The easiest way to do this is to export Excel to  a text file and use Get-Content to enumerate the contents.  Use ForEach-Object to enumerate.

    Apply the URLs from the file to the script parameters in the loop.

    It is that simple.  You just need to understand a bit about programming, PowerShell and programming.


    \_(ツ)_/

    • Marked as answer by YAMA-APP Friday, March 13, 2020 4:12 PM
    Friday, March 13, 2020 12:07 AM

All replies

  • Please do not post colorized code on TechNet sites.  The code you posted is not yours.  Delete it and post a link to the original.

    Please aske a clear question.  The code you posted has little to do with your question as your question is about how to use basic PowerShell and how to use it with PowerShell which has nothing to do with the Microsoft code.

    Please read the following carefully.


    \_(ツ)_/

    Thursday, March 12, 2020 11:25 PM
  • Here is the answer to your Excel question:

    https://lazywinadmin.com/2014/03/powershell-read-excel-file-using-com.html


    \_(ツ)_/

    Thursday, March 12, 2020 11:26 PM
  • The rest of the answer to your question is included in the documents that comes with the script.  P{lease read them carefully and try to understand all of the examples.

    https://docs.microsoft.com/en-us/sharepoint/dev/transform/modernize-userinterface-site-pages-powershell


    \_(ツ)_/


    • Edited by jrv Thursday, March 12, 2020 11:30 PM
    Thursday, March 12, 2020 11:29 PM
  • Dear Moderator, 

    Code I posted was from doc.microsoft.com . This code will translate the site pages from classic to modern and this is working fine. What our issue is, we are running this script for each site(We have more than 200 sites). 

    I am asking for help, to know how can I make changes in this script and read the site names from an excel sheet and covert all the site pages to modern in one run. 

    Hope, this make sense. 

    Thanks, 

    Y

    Thursday, March 12, 2020 11:40 PM
  • You do not make changes to the script you write a script that calls the MS script.  This is how basic PowerSHell is designed to work.  The MS script is designed to be called as a script without any need to change it.

    Start here:

    help about_scripts -Show


    \_(ツ)_/

    Thursday, March 12, 2020 11:46 PM
  • Thank you for the reply.

    I never worked in Power Shell, that is the reason I asking stupid. 

    What you mean is , I have to write a a script for reading the values from excel and then call the MS script from the new script?  

    Do you have any kind of example or an outline for this ? That will be helpful . 

    Thanks again ! 

    Y

    Thursday, March 12, 2020 11:52 PM
  • The examples are in the links I posted.


    \_(ツ)_/

    Thursday, March 12, 2020 11:59 PM
  • The easiest way to do this is to export Excel to  a text file and use Get-Content to enumerate the contents.  Use ForEach-Object to enumerate.

    Apply the URLs from the file to the script parameters in the loop.

    It is that simple.  You just need to understand a bit about programming, PowerShell and programming.


    \_(ツ)_/

    • Marked as answer by YAMA-APP Friday, March 13, 2020 4:12 PM
    Friday, March 13, 2020 12:07 AM
  • Thank you ! 
    Friday, March 13, 2020 4:12 PM