Показаны сообщения с ярлыком Powershell. Показать все сообщения
Показаны сообщения с ярлыком Powershell. Показать все сообщения

вторник, 10 января 2017 г.

Set Time Zone for the mailbox with Powershell

Open Powershell As Administrator and connect to Office365  

Set Time Zone for a Mailbox:


Set-MailboxRegionalConfiguration <Identity> -TimeZone <"Time Zone"> 

Example:

Set-MailboxRegionalConfiguration yourmailbox -TimeZone "Pacific Standard Time" 


Set Time Zone + Language for a Mailbox:


Set-MailboxRegionalConfiguration <Identity> -TimeZone <"Time Zone"> Language <Language Code> 

Example:

Set-MailboxRegionalConfiguration yourmailbox -TimeZone "Pacific Standard Time" Language en-US  


Display information about Time Zone and Language for a specific user:


Get-MailboxRegionalConfiguration <Identity> 

Example:

Get-MailboxRegionalConfiguration yourmailbox

Display Time zone and Language settings for all users:


$Users = Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} $Users | Get-MailboxRegionalConfiguration  

понедельник, 9 января 2017 г.

Export\Import NPS configuration with Powershell

Powershell comandlets for export and import Network Access Policy configuration

Step-by-step guide

  1. For export:  
    Export-NpsConfiguration -Path "C:\Npsconfig.xml"
  2. For import: 
    Import-NpsConfiguration -Path "C:\Npsconfig.xml"

Connect to Exchange Online with Powershell

Step-by-step guide


  1. Install MSOnline Sign-In Assistant for Windows Powershell http://go.microsoft.com/fwlink/?LinkID=286152
  2. Install Azure Active Directory Module for Windows Powershell   http://go.microsoft.com/fwlink/p/?linkid=236297
  3. Open Azure Active Directory Module for Windows Powershell   
  4. Connect to MSOnline services:  
    $msolcred = get-credential
    connect-msolservice -credential $msolcred
  5. Enjoy!

Share meeting room with shared organization


1. $UserCredential = Get-Credential
2.  $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
3.  Import-PSSession $Session
4.  Set-CalendarProcessing –Identity calendar@mydomain.com -ProcessExternalMeetingMessages $true
5.  Enjoy!

Manage Distribution Groups




Create Distribution Group


Syntax:

New-DistributionGroup -Name "<Distribution Group Name>" 
Example:
New-DistributionGroup -Name new-group 



Create Distribution Group with settings:


Syntax:

New-DistributionGroup -Name <DL name> -DisplayName <DL display name> -Alias <Alias> -PrimarySmtpAddress <Email Address>
Example:
New-DistributionGroup -Name new-group -DisplayName new-group -Alias new-group  -PrimarySmtpAddress new-group@mydomain.com




Add Users to Distribution Group:



Syntax:

Add-DistributionGroupMember "new-group" -Member vpupkin -BypassSecurityGroupManagerCheck

Example:

Add-DistributionGroupMember "new-group" -Member vpupkin -BypassSecurityGroupManagerCheck


Set Owner of Dustribution Group:


Syntax:

Set-DistributionGroup -Identity "<Distribution Group Name>" ManagedBy <Identity> -BypassSecurityGroupManagerCheck

Example:

Set-DistributionGroup -Identity new-group ManagedBy vpupkin  -BypassSecurityGroupManagerCheck



Remove Distribution Group:


Syntax:

Remove-DistributionGroup "<Distribution Group Name>"
Example:
Remove-DistributionGroup new-group


Add Email Aliases for Distribution Group:


Syntax:

Set-DistributionGroup "<Distribution Group Name>" -EmailAddresses SMTP:<Primary Email>,<Alias Email>
Example:

Set-DistributionGroup new-group-EmailAddresses SMTP:new-group@mydomain.com,achtung@mydomain.com


Hide Distribution Group from GAL (Global Address List):


Syntax:

Set-DistributionGroup "<Distribution Group Name>" -HiddenFromAddressListsEnabled $True
Example:
Set-DistributionGroup new-group -HiddenFromAddressListsEnabled $True



Get Information about Distribution Group members:



Syntax:

Get-DistributionGroupMember "Group Name>"

Example:

Get-DistributionGroupMember new-group

Get List of Distribution Groups:

Get-DistributionGroup  




Enjoy!

Useful cmdlets for Sharepoint Online

1) Before start working with SPO's powershell cmdlest you have to download those cmdlets. You can do it here: click me
2) Once installed open the SharePoint Online Management Shell by clicking Start > All Programs > SharePoint Online Management Shell > SharePoint Online Management Shell (As Administrator)
3) Getting Connected:  

Connect-SPOService -Url https:mydomain.sharepoint.com -Credential vasyapupkin@mydomain.com

SPO Cmdlets

Site Groups:

  • Get-SPOSiteGroup – Get a Site Collection Site Group.
  • New-SPOSiteGroup – Create a new Site Collection Site Group.
  • Remove-SPOSiteGroup – Remove an existing Site Collection Site Group.
  • Set-SPOSiteGroup – Set the permission level and/or owner of an existing Site Collection Site Group.

Users:

  • Add-SPOUser – Add a user to an existing Site Collection Site Group.
  • Get-SPOUser – Get an existing user.
  • Remove-SPOUser – Remove an existing user from the Site Collection or from an existing Site Collection Group.
  • Set-SPOUser – Set whether an existing Site Collection user is a Site Collection administrator or not.
  • Get-SPOExternalUser – Returns external users from the tenant’s folder.
  • Remove-SPOExternalUser - Removes a collection of external users from the tenancy's folder.

Site Collections:

  • Get-SPOSite – Retrieve an existing Site Collection.
  • New-SPOSite – Create a new Site Collection.
  • Remove-SPOSite – Move an existing Site Collection to the recycle bin.
  • Repair-SPOSite – If any failed Site Collection scoped health check rules can perform an automatic repair then initiate the repair.
  • Set-SPOSite – Set the Owner, Title, Storage Quota, Storage Quota Warning Level, Resource Quota, Resource Quota Warning Level, Locale ID, and/or whether the Site Collection allows Self Service Upgrade.
  • Test-SPOSite – Run all Site Collection health check rules against the specified Site Collection.
  • Upgrade-SPOSite – Upgrade the Site Collection. This can do a build-to-build (e.g., RTM to SP1) upgrade or a version-to-version (e.g., 2010 to 2013) upgrade. Use the -VersionUpgrade parameter for a version-to-version upgrade.
  • Get-SPODeletedSite – Get a Site Collection from the recycle bin.
  • Remove-SPODeletedSite – Remove a Site Collection from the recycle bin (permanently deletes it).
  • Restore-SPODeletedSite – Restores an item from the recycle bin.
  • Request-SPOUpgradeEvaluationSite - Creates a copy of the specified Site Collection and performs an upgrade on that copy.
  • Get-SPOWebTemplate – Get a list of all available web templates.

Tenants:

  • Get-SPOTenant – Retrieves information about the subscription tenant. This includes the Storage Quota size, Storage Quota Allocated (used), Resource Quota size, Resource Quota Allocated (used), Compatibility Range (14-14, 14-15, or 15-15), whether External Services are enabled, and the No Access Redirect URL.
  • Get-SPOTenantLogEntry – Retrieves company logs (as of B2 only BCS logs are available).
  • Get-SPOTenantLogLastAvailableTimeInUtc – Returns the time when the logs are collected.
  • Set-SPOTenant – Sets the Minimum and Maximum Compatibility Level, whether External Services are enabled, and the No Access Redirect URL.

Apps:

  • Get-SPOAppErrors – Returns application errors.
  • Get-SPOAppInfo – Returns all installed applications.

Connections:

  • Connect-SPOService – Establishes a connection to a SharePoint Online Tenant Administration Site.
  • Disconnect-SPOService – Clears an existing connection.

Enjoy!

Deleted Exchange Calendar item keeps coming back


  1. Connect to Office365 with Powershell
  2. Disable Callendar Repair Assistant with command:    Set-Mailbox vasya@yourdomain.com -CalendarRepairDisabled $true



The Calendar Repair Assistant performs the following functions:
  • Detects inconsistencies
  • Determines if inconsistencies were intentional
  • Corrects inconsistencies 
  • Sends a calendar repair update message if a correction was made
       3. Search and Delete required meeting in calendars:    Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'from:"vasya@yourdomain.com" AND kind:meetings AND SUBJECT:"Type your subject"' -DeleteContent -Force
       4. Just for case if you are looking for another content removal:

–SearchQuery kind:contacts
–SearchQuery kind:notes
–SearchQuery kind:tasks
–SearchQuery kind:im
–SearchQuery kind:email


      5. Enjoy!

Connect to Office365 with Powershell


Step-by-step guide

  1. Run Windows Powershell as Administrator
  2. Login to Office365 with your admin account with command:  
    $LiveCred = Get-Credential



         3.  Import session for Office365 manage:

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



вторник, 30 августа 2016 г.

Remove unneeded apps from Windows 10

Run Powershell As Administrator and enter commands:

Remove 3D from Windows 10
Get-AppxPackage *3d* | Remove-AppxPackage

Remove Camera from Windows 10
Get-AppxPackage *camera* | Remove-AppxPackage

Remove Mail and Calendar from Windows 10
Get-AppxPackage *communi* | Remove-AppxPackage

Remove Money, Sports, News and Weather from Windows 10
Get-AppxPackage *bing* | Remove-AppxPackage

Remove Groove Music and Film & TV from Windows 10
Get-AppxPackage *zune* | Remove-AppxPackage

Remove People from Windows 10
Get-AppxPackage *people* | Remove-AppxPackage

Remove Phone Companion from Windows 10
Get-AppxPackage *phone* | Remove-AppxPackage

Remove Solitaire Collection from Windows 10
Get-AppxPackage *solit* | Remove-AppxPackage

Remove Voice Recorder from Windows 10
Get-AppxPackage *soundrec* | Remove-AppxPackage

Remove Xbox from Windows 10
Get-AppxPackage *xbox* | Remove-AppxPackage

понедельник, 29 августа 2016 г.

Set Calendar permissions in Office365

You can add permissions on a specific mailbox, or you can add it onto a security group.


Step-by-step guide

  1. Run Windows Powershell as Administrator
  2. Login to Office365 with your admin account with command:  
    $LiveCred = Get-Credential


    1. Import session for Office365 manage:
      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

    2. Provide permissions:
      Add-MailboxFolderPermission -Identity user1@domain.com:\calendar -user user2@domain.com -AccessRights Editor

      1

      The AccessRights parameter also specifies the permissions for the user with the following roles, which are a combination of the rights listed previously:

      • None – FolderVisible
      • Owner – CreateItems, ReadItems, CreateSubfolders, FolderOwner, FolderContact, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
      • PublishingEditor – CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
      • Editor – CreateItems, ReadItems, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
      • PublishingAuthor – CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, DeleteOwnedItems
      • Author – CreateItems, ReadItems, FolderVisible, EditOwnedItems, DeleteOwnedItems
      • NonEditingAuthor – CreateItems, ReadItems, FolderVisible
      • Reviewer – ReadItems, FolderVisible
      • Contributor – CreateItems, FolderVisible


четверг, 14 июля 2016 г.

Exchange Server mailbox permissions with Powershell

Send on Behalf – This will grant testuser user send on behalf permissions for Accounting mailbox:

 Set-Mailbox accounting -GrantSendOnBehalfTo testuser


Send As – This will grant testuser user send as permissions for Accounting mailbox:

Add-ADPermission accounting -ExtendedRights Send-As -user testuser



Full Mailbox Access – This will grant testuser user, full access to Accountng's Mailbox:

Add-MailboxPermission -Identity accounting -User testuser -AccessRights FullAccess -InheritanceType All