Thursday, July 16, 2015

What is the cloud?

The cloud is a friendly way of describing web-based computing services that are hosted outside of your organization. When you use cloud-based services, your IT infrastructure resides off your property (off-premises), and is maintained by a third party (hosted), instead of residing on a server at your home or business (on-premises) that you maintain. With Office 365, for example, information storage, computation, and software are located and managed remotely on servers owned by Microsoft. Many services you use every day are a part of the cloud—everything from web-based email to mobile banking and online photo storage. Because this infrastructure is located online or “in the cloud,” you can access it virtually anywhere, from a PC, tablet, smartphone, or other device with an Internet connection.

Office 365

Office 365 refers to subscription plans that include access to Office applications plus other productivity services that are enabled over the Internet (cloud services), such as Skype for Business web conferencing and Exchange Online hosted email for business, and additional online storage with OneDrive and Skype minutes for home.
Many Office 365 plans also include the desktop version of the latest Office applications, which users can install across multiple computers and devices. The full, installed applications include: Word, Excel, PowerPoint, OneNote, Outlook, Publisher, and Access. (Publisher and Access are available on PC only.) And you can install them across multiple devices, including PCs, Macs, Android tablets, Android phones, iPad, and iPhone. When you have an active Office 365 subscription that includes the desktop version of Office, you always have the most up-to-date version of the applications.
The Office 365 plans that are online-only are a great choice for certain business needs, and they are compatible with desktop versions of Office 2010, Office 2007 (with slightly limited functionality), Office 2011 for Mac, and Office 2008 for Mac. This does not include the Exchange Online Kiosk or Office 365 Enterprise K1 plans.

All Office 365 plans are paid for on a subscription basis, monthly or annually.

Creating bunch of users using CSV file in office365

Today, I am going to create a CSV file and use it to create a bunch of users for my Office 365 installation. Now I just want to create a bunch of users.
To create a user in Office 365 by using the Azure AD module, I use the New-MSOlUser cmdlet. The syntax for this looks an awfully lot like the New-User cmdlet in the standard Active Directory module. There are not quite as many options, but the process is very similar. Here is the syntax for the New-MSOlUser cmdlet:
NAME
    New-MsolUser
SYNOPSIS
    Adds a new user to Windows Azure Active Directory.
SYNTAX
    New-MsolUser -DisplayName <string> -UserPrincipalName <string>
    [-AlternateEmailAddresses <string[]>] [-AlternateMobilePhones <string[]>]
    [-BlockCredential <Boolean>] [-City <string>] [-Country <string>] [-Department
    <string>] [-Fax <string>] [-FirstName <string>] [-ForceChangePassword <Boolean>]
    [-ImmutableId <string>] [-LastName <string>] [-LicenseAssignment <string[]>]
    [-LicenseOptions <LicenseOption[]>] [-MobilePhone <string>] [-Office <string>]
    [-Password <string>] [-PasswordNeverExpires <Boolean>] [-PhoneNumber <string>]
    [-PostalCode <string>] [-PreferredLanguage <string>] [-State <string>]
    [-StreetAddress <string>] [-StrongPasswordRequired <Boolean>] [-TenantId <Guid>]
    [-Title <string>] [-UsageLocation <string>] [<CommonParameters>]
To use the cmdlet, it is as simple as filling in the blanks. Here is a quick example:
New-MsolUser -UserPrincipalName "ex@example.Com" -City
 Charlotte -State NC -Country USA -DisplayName Scripting
In this command, I did not assign a password. The cmdlet returns a user object, and that user object includes a password. I could then pipe the information from the returned object to Send-SMTPMail to send the user information and password to the user. The cool thing is that I do not have to create a password, nor do I have to supply one when I create the new user. Here is the output from the command in the Windows PowerShell console:



When I go to the Office 365 tenant admin site, I can see that the Scripting Wife user has indeed been created:




Add information to properties of external contacts

After you run the command in step 2, the external contacts are created, but they don’t contain any of the contact or organization information, which is the information from the most of the cells in the CSV file).
Run the following commands to add the other properties from the CSV file to the external contacts you created:
$Contacts = Import-CSV .\externalcontacts.csv
$contacts | ForEach {Set-Contact $_.Name -StreetAddress $_.StreetAddress -City $_.City -StateorProvince $_.StateorProvince -PostalCode $_.PostalCode -Phone $_.Phone -MobilePhone $_.MobilePhone -Pager $_.Pager -HomePhone $_.HomePhone -Company $_.Company -Title $_.Title -OtherTelephone $_.OtherTelephone -Department $_.Department -Fax $_.Fax -Initials $_.Initials -Notes $_.Notes -Office $_.Office -Manager $_.Manager}
Don’t worry if you don’t have all the information populated in the CSV file. If it’s not there, it won’t be added.
Note: The Manager parameter can be problematic. If the cell is blank in the CSV file, you will get an error and none of the property information will be added to the contact. If you don’t need to specify a manager, then just delete –Manager $_.Manager from the previous PowerShell command.

That’s it. You can view the contact properties in the Exchange Control Panel. Users can see the contacts in the address book Outlook and Outlook Web App.

Create external contacts

In this step (and the next one), you have to use Windows PowerShell. To connect PowerShell to your Exchange Online organization.
After you connect PowerShell to your cloud-based organization, run the following command to create the external contacts:
Import-Csv .\ExternalContacts.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}
Note: This command assumes that you are in the desktop directory in PowerShell. For example, C:\Users\Administrator\desktop.

To view the new external contacts, in the Exchange Control Panel, click Users & Groups > External Contacts > Refresh. They also appear in the shared address book in Outlook and Outlook Web App.

Hide external contacts from the shared address book

Some companies may use external contacts only so they can be added as members of distribution groups. In this scenario, they may want to hide external contacts from the shared address book. Here’s how:
Hide a single external contact
Set-MailContact <external contact> -HiddenFromAddressListsEnabled $true
For example, to hide Franz Kohl from the shared address book:
Set-MailContact “Franz Kohl” -HiddenFromAddressListsEnabled $true
Hide all external contacts
Run the following command to hide all external contacts from the shared address book:

Get-Contact -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'MailContact')} | Set-MailContact -HiddenFromAddressListsEnabled $true

Removing a group of users in office365

If you need to remove a group of users, You can once again use the CSV file. In fact, if you want to remove the users you just created, it is super simple. All you need to do is to use the Remove-MsolUser cmdlet instead of the New-MSOlUser cmdlet. you want also want to use the –Force parameter. If you do not, the command will prompt for each user, which is probably not what you want to do. Here is the command without the –Force parameter:
PS C:\> $users = Import-Csv C:\fso\Office365Users.CSV
PS C:\> $users | ForEach-Object { Remove-MsolUser -UserPrincipalName $_.userprincipalname}
Confirm
Continue with this operation?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):
So instead, you use the –Force parameter as shown here:
$users | ForEach-Object { Remove-MsolUser -UserPrincipalName $_.userprincipalname -Force}

No output returns from this command.

Wednesday, July 15, 2015

Install Windows Azure Active Directory Module for Windows PowerShell

The cmdlets to connect to Office 365 and the powershell module:

Please install :

Microsoft Online Services Sign-In Assistant for IT Professionals RTW
•Windows Azure Active Directory Module for Windows PowerShell

From the below link:

Connect Powershell to Office 365 using the next set of cmdlets:
•Set-ExecutionPolicy Unrestricted

•$LiveCred = Get-Credential

•$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUrihttps://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

•Import-PSSession $Session

•connect-msolservice -credential $livecred

You can also perform a bulk user import directly from the portal:

Bulk Import of Mailboxes

Import-Csv C:path\filepath.csv | foreach{New-MsolUser -UserPrincipalName  $_.email  -DisplayName  $_.Displayname  -FirstName  $_.FirstName  -LastName  $_.LastName}

Note:

Don't use any special characters for first name, last name, Email & display name.

Change Password for all users

Import-Csv C:path\filename.csv|foreach{Set-MsolUserPassword -userPrincipalName $_.UserPrincipalName -NewPassword “Enter Requied pwd” -ForceChangePassword $true}

 Force Change Password: 
If you want make user to change password in first logon and it is optional

$true: force user to change password

 $false: Not force user to change password

Enter Required Password:

You need to enter required password to set for all users. Example: password

Unable to process argument because the value of argument “name” is invalid

Append Import cmdlet in following way

$csv=import-csv “PATH” –header(“column1”,”column2”,”column3”,”column4”,”column5”)

Example:

Import-csv “C:\Filepath” –header(“firstname”,”lastname”,”email”,”displayname”)| foreach{New-MsolUser -UserPrincipalName  $_.email  -DisplayName  $_.Displayname  -FirstName  $_.FirstName  -LastName  $_.LastName}


Note:


Header columns sequence must be same as csv file column sequence.

Manage Distribution Groups - Add new member to existing distribution group

Add-DistributionGroupMember "<Distribution Group Name>" -Member <User Name> -BypassSecurityGroupManagerCheck

<User Name> -> Display Name

example:


Add-DistributionGroupMember -identity "GroupName" –Member exampleMember  -BypassSecurityGroupManagerCheck

Start Session in Powershell

Description: this document describes using windows PowerShell and to connect to exchange online
1.    Web Links for Admins
a)    Outlook Live Videos: http://help.outlook.com/en-us/140/gg622914.aspx
b)    Install and configure Powershell: http://help.outlook.com/en-us/140/cc952756.aspx
c)    Mail Clients: FAQs for Live@edu Administrators: http://help.outlook.com/en-us/140/cc875924.aspx
d)    Account Maintenance: FAQs for Live@edu Administrators: http://help.outlook.com/en-us/140/Cc875956.aspx
e)    Enrollment: FAQs for Live@edu Administrators: http://help.outlook.com/en-us/140/Cc875912.aspx

2.    Install PowerShell for Windows (Note: Windows XP and Windows 7 have different installers)
3.    Verify the account you will use to connect is authorized to connect using Windows PowerShell. For more information, see http://help.outlook.com/en-us/140/dd256962.aspx
4.    Connect Windows PowerShell on your local computer to the cloud-based service. Click Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell. Start PowerShell in Admin Mode
5.    Admin Login:  Login ID: 







6.    Run the following command:
$LiveCred = Get-Credential







7.    In the Windows PowerShell Credential Request window that opens, type the credentials of an account in your cloud-based organization. When you are finished, click OK. Use School Admin or Master Admin or AB account. Run the following command:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
   Note: The AllowRedirection parameter enables cloud-based organizations in datacenters all over the world to connect Windows PowerShell to the cloud-based service by using the same URL.
            Set-ExecutionPolicy RemoteSigned







8.    Run the following command:
Import-PSSession $Session
   Note: A progress indicator appears that shows the importing of commands used in the cloud-based service into the client-side session of your local computer. When this process is complete, you can run these commands.

9.    Disconnect Windows PowerShell from the cloud-based service

When you're finished using the server-side session, always disconnect Windows PowerShell by running the following command:
Remove-PSSession <session variable>
For example, to disconnect from the server-side session that is defined by the $Session variable, run the following command:
Remove-PSSession $Session

Important   If you close the Windows PowerShell window without disconnecting from the server-side session, your connection will remain open for 15 minutes. Your account can only have three connections to the server-side session at one time.

Create Mailbox for office365

New-MsolUser -UserPrincipalName  mailid@example.com -DisplayName  “Mention displayname” -FirstName  “Mention firstname” -LastName  “Mention last name”

Add bulk members to distribution group

Adding the bulk members to distribution group

Get-content  path of file\selectedfile.csv| Add-DistributionGroupMember -Identity "distribution groupname"

Use any of the Text or Csv file

In text or Csv file must contain any one emails or displayname of  users(heading is not required)

Fetch list of Mailboxes related to particular domain


Fetching the mailboxes information from particular domain

get-mailbox -resultsize unlimited | where {$_.primarysmtpaddress -like "*@Extention.in"} 


Extention.in ->Mention the related Url.

Mailbox Count

Get total number of mailboxes in cloud

 (get-mailbox).count

---------------------------------------------------------------------------------------------------
Get number of mailboxes in particular Domain


(get-mailbox -resultsize unlimited | where {$_.primarysmtpaddress -like "*@example.com"} ).count

example.com --> write required domain name

-----------------------------------------------------------------------------------------------------

Get number of mailboxes in particular Distribution group


(Get-disributiongroupmember -identity "groupName").count


Group Name --> write required name of group