none
How to run a script in an Office 365 environment RRS feed

  • Question

  • We would like to run this script: https://gallery.technet.microsoft.com/office/How-to-export-all-the-9870e78b/view/Discussions#content - to export a list of groups in Office 365 to a .CSV file.  Our apologies as we are new to scripting! 

    We would appreciate help in understanding how to run the script:

    1. We have attempted to run the script on a windows machine.  We are going to Powershell, entering the text from the script. We received two different error messages -

    a) Access is denied. We are trying to export a list of groups for a 3rd party and we have multiple Office 365 accounts. We have a global admin account that we enter in the log in screen in order to get access for the 3rd party's Office 365 account. This is not accepted. Our own global admin account that we use on the machine works and we get access. Why can't we sign in using the 3rd party's global admin account?

    b) We can't run scripts on the machine.  We followed the steps to enable scripts in the Registry Editor but we don't have the Ënabled  option under Windows Script Host/Settings. How do we enable scripts?

    Once the above problems are solved, we will have an additional question  -

    1) What level of administrator account can run this script? Will an Exchange Administrator role suffice?

    Thanks very much for your help. 

    • Moved by Bill_Stewart Wednesday, September 4, 2019 7:11 PM This is not "train me in the basics" forum
    Friday, February 22, 2019 10:07 PM

All replies

  • Group Policy can block your changes.

    To enable scripts to run use the following command once at an elevated prompt.

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

    If it fails then Group Policy is blocking this change and you will have to ask your domain or network admins for help.

    Remote O365 scripts do not require admin permissions to run. Any O365 user with correct permissions on the portal/tenant can access any information they have permission to access.  Post in O365 forums to ask for help on this.

    For assistance with Gallery scripts please post your question in the Gallery script Q&A page.

    For this script post here: https://gallery.technet.microsoft.com/office/How-to-export-all-the-9870e78b/view/Discussions#content


    \_(ツ)_/


    • Edited by jrv Friday, February 22, 2019 10:40 PM
    Friday, February 22, 2019 10:36 PM
  • Great thanks you solved our problem. 
    Monday, February 25, 2019 1:20 AM
  • After we have exported the list using the script, we now want to return Powershell to its default setting of restricting scripts being run on the end user's PC.  Does this happen automatically or do we have to run a command to disable scripts?

    Thanks for your help.

    Friday, March 22, 2019 1:24 AM
  • After we have exported the list using the script, we now want to return Powershell to its default setting of restricting scripts being run on the end user's PC.  Does this happen automatically or do we have to run a command to disable scripts?

    Thanks for your help.

    The command does not enable scripts or disable scripts.  That cannot be done easily and should not be done.  The signing needs to be set as "RemoteSigned" or "AllSigned"

    Read the help for the CmdLet to learn more.


    \_(ツ)_/

    Friday, March 22, 2019 1:40 AM
  • Sorry, please forgive our ignorance, but I thought that the command was to enable scripts.

    The end user is concerned about security.  So once you run the "RemoteSigned" script, they want to return to whatever the status was before they ran the "RemoteSigned" script.   Are there are any security issues after you run this command and select Y Yes?  Thank you

    Friday, March 22, 2019 2:01 AM
  • In order to correctly answer that question you will need to learn about PowerShell security. The best we can do is show you the options.  Security issues are very much context oriented and a security knowledgeable person should consult with the customer to determine what it is that they are asking.

    The CmdLet does not et security or guarantee any security. It is used to protect the user from obvious mistakes.

    You will need to learn PowerShell to understand this.


    \_(ツ)_/

    Friday, March 22, 2019 2:50 AM
  • Thanks so much, your help is much appreciated. 
    Friday, March 22, 2019 3:35 AM