10 useful Office 365 PowerShell snippets

This post is written referenced by 10 useful Office 365 PowerShell snippets, I am still working on office 365 , but sometimes I forgot how can I get my tenant which I made, so I should find it then so as to see whenever I need to remember or memorize that, I introduce you about this note,

I did subscribe office 365 develop version for 1 year trial, it needs to make my own office 365 , in this trial I will do a lot of working without adfs environment, I will start it again.

If you open this post , you can see useful snippets which you used before.

I utilized this post so that create new users using powershell in a long time.

developerpack_accountsku

If you see my accountSkuId, it shows DEVELOPERPACK instead of ENTERPRISEPACK, as I’ve already mentioned I made a office365 trial version for developerpack so as to test 1 yr instead of 1 month, and If I see ConsumedUnits which describes 1 , it means I just one user as global administrator in this tenant.

 

About Groups for Office365

It takes to make new item on blog, I forgot totally to add new one or udpate it, but so as to elevate my ability and interesting stuff, I start again to make new item on this blog.

Anyway when I see around office 365 portal and if I make new distribution group using powershell, I can see introduction office 365 groups on top of powershell execution window, so I have a question what are these differences apparently about Groups.

If we see groups , there are four kinds of groups , for example, Office 365 groups, Distribution groups, Mail enabled security groups, Security groups. On this blog I’ll show you about explanations , differences, how to make it using powershell, it may takes times more than I expected.

If you have a experience of Active Directory , you can notice what is the Security group, this is sort of authorization for resources which we are uisng for example on the oneDrive and Sharpoint, etc., and Mail enabled security groups can be used to control access to OnDrive and Sharepoint as well as to send email to all members of the list. Distribution lists send email to all members of the list. You can even allow people outside to your organization send email to list. But if you make distribution group using powershell, it can use only in the tenant, it is not send from outside. Last thing is Office 365 groups , we may think this is related to groups, but if you make it then see in details, it looks like groups like facebook , this is a great way for teams to collaborate by giving them a group email and a shared workspace for conversations, files and calendar events.

PowerShell

  • Office 365 Groups : New Office 365 groups , use New-UnifiedGroup cmdlet
  • Distribution group : New Distribution group, use New-DistributionGroup cmdlet.
  • Security Group : New Security grooup, use New-MsoleGroup cmdlet, or New-Distribution cmdelet with Type properties with security (New-DistributionGroup -Name “File Server Managers” -Alias fsadmin -Type security)
  • Mail-enabled security groups : it looks no way using powershell, if looks like if we make new security group using new-distributiongroup cmdlet, we can change properties. if you see this link, you can know how it works.

If we make security group, there have two way, one is using New-DistributionGroup and another is new-MsolGroup, I want to know New-MsolGroup cmdlet, but if we go to link , it explained to create security group.

 

Set Pager Attribute on Active Directory

Recently I didn’t make any post of relating office365, but anyway it needs to start again.

Since when I create Bulk AD users for Office 365, I have wonder how to set pager attribute automatically using powershell without manually, and I tried to find pager attribute on the new-aduser cmdlet, it cannot find so as to set pager attribute, in case of us we are using pager attribute for special purpose to distinguish user.

Let me show example, if you have csv file to use new ad user, you can add it into new-aduser cmdlet, -OtherAttributes @{‘Pager’ = $_.Pager} , basically new-aduser cmdlet cannot support Pager attribute.

New-ADUser  -Name $SAM -DisplayName “$Displayname” -SamAccountName $SAM -UserPrincipalName $UPN -GivenName “$UserFirstname” -Surname “$UserLastname”  -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path “$OU” -EmailAddress $Email  -Office $Office -ChangePasswordAtLogon $false –PasswordNeverExpires $false -Server $ADServer -OtherAttributes @{‘Pager’=$_.Pager}
If you want to see more in details , you need to go and check below link.

https://powershell.org/forums/topic/active-directory-pager-field/

 

Office365 Security group owner change

Sometimes, it needs to change office 365 security group’s owner, normally we use set-distribution cmdlet, but when you try that, you can encounter error ,

when you want to change owner, you need to use parameter basically BypassSecurityGroupManagerCheck , and mangedby ‘s value needs to set samaccount instead of userprincipalanmesetower-securitygrp

if you want to know Set-Distribution cmdlet, you need to click below link.  https://technet.microsoft.com/ko-kr/library/bb124955(v=exchg.160).aspx

 

 

Electronic Discovery(EDiscovery)

Sometimes defined as how records managers and litigators discover content stored in electonic format. It means the process by which searches are conducted across online sources so that information meeting the criteria for a legal discovery order can be found and made available for review

Both Exchange Online and SharePoint Online suppor in-place holds. It works by retaining content where is stored when a discovery search is performed. In-place hold is able to include all kinds of content stored in a mailbox or site. If items that come under the scope of an in-place hold are edited or deleted after hold is created, the application ensures the information is retained. For example, if a mailbox owner attempts to delete an item that is on hold, Exchange Online creates a copy of the items in a folder in the Recoverable items structure. The copied items are invisible to users and client but can still be discovered and retrieved by searches. [All coments are gotten by office 365 for IT pros book]

recv1

As I know the Recoverable items structure quota is 100G, if that structure is exceeeded to that quota, there are some odd symptoms such as deleted items folder cannot clean-up even if users are trying to deleted items from user’s folder, so as to use EDiscovery feature for storing and searching data , I think users need to use online archive instead of deleteing items on their folders.

 

Anyone who are reading this EDiscovery feature, you need to know that Recoverable items sturcture, if you see Office 365 for IT Pros mentioned when that structure’s quota is exceeded , it needs to contact to increase or not of that structure, but when I checked to ms engineer, that feature is not use.

 

 

Security and Compliance in office 365 for business (1st)

Today, I’ll study and write down about security and compliance center on office 365, it looks as if to manage stored data for secure as company getting content more than now.

I have a curiosity about what is it eDiscovery and mail retention , so as to understand to be administrator and get certification for it, it needs to know and understand deeply, currently eDiscovery is using to find and hold content rleated to a legal case.

If you want to know in details , please go to this site. https://support.office.com/en-us/article/Security-and-Compliance-in-Office-365-for-business-Admin-Help-7fe448f7-49bd-4d3e-919d-0a6d1cf675bb?ui=en-US&rs=en-US&ad=US

And I’ll introduce it as I read this article and practice on my test tenant to that feature.

Get started with Office 365 SharePoint Online dev – create environment part 1

I finally find some pages related to how to make environment for office 365 sharepoint online dev, if you want to know that, you should go this link.

I’ve already created office 365 my own tenant and with my own configuration such as domain which I own, service and other service values to activate for office 365. so this post just concentrate on how to make environment for office 365 sharepoint online dev.

First. Go to SharePoint admin center , then select settings

SPAdminCenter.pngThen go to “Custom Script” section, please change value to “Allow users to run custom script on personal sites”

CustomScript.pngSecond, You go to SharePoint admin center, then open apps

apps.png Click to “App Catalog” appcatalog.png Select  “There is no app catalog site created for your tenant”. then select “Create a new app catalog sitecreatenewappcat.png

You have to valid values to create app catalog site , if input properly , click “OK”createnew.png if you go to SharePoint admin center, you can see the site which you just created , it looks provisioning to that site. sitelist.png

You can use it to upload any custom apps that your organization has developed.Uploading custom apps isn’t much more complicated that uploading a document to a library and setting some properties. You can use the App Catalog site to do things like install custom or third-party apps on sites for users (also called app deployment), if you want to know more how to add custom apps and install apps, you need to go to this link.

Frankly I’m happy to make this post, it is clearly help to approach sharepoint online development.

Add new domain to office 365 portal(2)

Today, I’ll show how to confirm domain which I want to add office 365 portal using powershell.

It is so easy to confirm domain which I want to, because I’ve already added txt record to dns management site, so if I use Confirm-MsolDomain cmdlet, it shows successfully verified.

confirmdomainif you excute that powershell, you can get values, Availability, AvailabilityDetails, it shows “The domain has been successfully verified for your account.”

showmessages, If I go to see dns status, it shows the status is “setup in progress”, so it looks theare are more jobs to proceed such as “Set up as Default”, so as to set domain as default, I use Set-MsolDomain cmdlet with IsDefault option like below image.

setdomaincmdlet.pngthen if you go to admin page about dns, you can show my new domain have set “Default”

setasdefaultdomainIf I see new domain status on admin page, it shows “Setup in progess”, what should I do next? In my case I did add wrong values to dns , so as to work well, it needs to clean up

Add new domain to office 365 portal(1)

Today I’m explaining how to add new domain which I have owned to office 365 using powershell.

newDomain.png, if you execute those powershell, I can get Text record value like this.

txtRecord1.png

In this post describes using New-MsolDomain cmdlet, to get txt record value, I am using Get-MsolDomainVerificationDns cmdlet.If you use Get-MsolDomainVerificationDns cmdlet, you can get DNS record that needs to be set to verify a domain.

Then I go to godaddy site to add txt values which I get from using that powershell, I added it.

Even if I go to my office 365 admin center, it added ysahpro.com as status of “Setup in progress”

admin_domainpage

Next post I’ll confirm my domain using powershell, it may use “Confirm-MsolDomain”cmdlet, it looks like awesome using powershell

 

 

How to check your tenant name in office 365

Yesterday I bought one domain to use my office 365 temp tenant from godaddy, before buying domain from godaddy, I think it was expensive but that site have more cheaper domain to use on my own.

Normally if I add domain to office 365, I usually use office 365 admin page, but today I’ll go proceed using only powershell.

Before adding domain, it needs to check it first, what is my tenant name? You can check it if you go to sharepoint on admin center as manually.

tenantname1  Then if the sharepoitn admin center open, you can now what is your tenant name, my tenant name is “cloudwide1610”

tenantname2

or based on our original plan, if you use get-msolaccoutsku cmdlet, you can see easily check what is your tenant name.if you see yellow circle, you can know it.

gettenantnameps

I’ll make posts to add domain using powershell.on office 365 environment. Thank you for reading my posts.

 

 

텐서 플로우 블로그 (Tensor ≈ Blog)

머신러닝(Machine Learning), 딥러닝(Deep Learning) 그리고 텐서(Tensor) 또 파이썬(Python)

Jaap Wesselius

Microsoft UC Specialist

Office365 Cloud for My site

Office365 & SharePoint & PowerShell