locked
How do I apply powershell commands to all users?? RRS feed

  • Question

  • Surely there is something in built to powershell to universally apply all commands to all users/global (this is with regards to Office 365 administration)

    I thought possibly exporting user list from Office 365 into CSV file then using 'ImportCsv ./file.csv | command -param etc'....would that apply commands following the pipe to all users within csv or is there some hidden -global or -allusers parameter I cant find anywhere?!

    this is doing my head in any help would be much appreceated

    Tuesday, May 23, 2017 2:50 PM

Answers

  • Not sure on the Office365 cmdlets, but why not something like the following, as if you were setting all users in ad?

    Get-ADUser -Filter * | Set-ADUser -Replace @{Property = 'Value'}


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Tuesday, May 23, 2017 3:18 PM

All replies

  • Not sure on the Office365 cmdlets, but why not something like the following, as if you were setting all users in ad?

    Get-ADUser -Filter * | Set-ADUser -Replace @{Property = 'Value'}


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Tuesday, May 23, 2017 3:18 PM
  • how would I then use this to apply to other commands?
    Tuesday, May 23, 2017 3:39 PM
  • No idea since you are not being specific as to what you are trying to do or what you mean by other "commands".

    The above I gave you is just an example of getting all users from AD and then running another "command" to change an attribute on all users. Office365 should be somewhat the same concept, I just do not know the cmdlets off hand, or what is needed, since you are not explaining what you want to do.


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Tuesday, May 23, 2017 3:50 PM
  • no worries I meant with other cmdlets, nothing specifically more of a general sense for example user wants to apply permission to all users or remove, another example I guess if a user wants to bulk disable email forwarding for all users. just surprised most of the cmdlets don't have a built in parameter to apply to all users
    Tuesday, May 23, 2017 4:12 PM
  • Hi,

    >>ust surprised most of the cmdlets don't have a built in parameter to apply to all users

    Yes, not all cmdlets contains this parameter.

    But, we could consider using workarounds e.g. .net framework library and etc.

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, May 24, 2017 9:56 AM