这是与之相关的文章 在Office 365中的PowerShell脚本中使用CSOM。正如我在那篇文章中提到的那样,为Office 365编写PowerShell大致有3种方式–确切地说,您需要运行哪些命令将决定您使用哪个命令,但是它确实’也可以设想您可能在同一脚本中使用所有3个脚本。当您开始使用Office 365时,我认为’它们之间容易混淆,或者无法完全理解它们全部存在。我什么’我想到这里是:
味道 | 笔记 | 例子 | 安装后,您’ll have: |
SharePoint Online(SPO)cmdlet | 这些是 SharePoint Online 具体的,可以通过“SPO”在cmdlet的名词部分中。 |
| ![]() |
MS Online(MSOL)/ WAAD cmdlet | 这些是与Office 365租赁有关的命令(但不一定特定于Exchange,Lync或SharePoint),并且可以通过以下方式识别“Msol”在cmdlet的名词部分中。 |
| ![]() |
在PS脚本中使用SP CSOM | 我其他帖子的主要重点是 在Office 365中的PowerShell脚本中使用CSOM |
| 无需安装–您可以在常规Windows PowerShell命令提示符下运行这种类型的脚本。 |
有关MSOL / Windows Azure AD cmdlet的注释
您可能想知道为什么MSOL cmdlet显示“Windows Azure Active Directory。”在快捷方式标题中(全名是“适用于Windows PowerShell的Windows Azure Active Directory模块”),尽管其他所有内容都被标记了“MSOnline” or “MSOL”。答案是,最初这些cmdlet被称为“Windows PowerShell cmdlet的Microsoft联机服务模块”,但是从那时起,Microsoft便将Windows Azure Active Directory作为正式服务推出。 Windows Azure Active Directory(WAAD)支持每个Office 365租约 –并且由于MSOL cmdlet始终专注于目录内容(管理用户/组,管理与Active Directory的同步等),因此这些已被WAAD产品所吸收。
入门
如果你’对于将定期使用Office 365的开发人员或管理员,我建议安装‘shells’用于SharePoint Online和Office 365 PowerShell命令– you’在某个时候可能会需要它们。
- 如果不安装,请安装PowerShell 3.0’还没有。它’Windows Management Framework 3.0中包含的- http://www.microsoft.com/en-us/download/details.aspx?id=34595
- 安装SPO cmdlet- http://office.microsoft.com/en-gb/sharepoint-help/redir/XT102919083.aspx?CTT=5&origin=HA102919087
- 安装MSOL cmdlet- http://technet.microsoft.com/en-us/library/jj151815.aspx#bkmk_installmodule
安装完成后,’重新准备开始思考“top of script”内容(例如,向Office 365进行身份验证)。您’ll find that it’SPO和MSOL脚本都非常相似,但是必须运行不同的cmdlet才能启动会话:
- 连接SPO服务
- Connect-MsolService
脚本示例– SPO scripts
向SharePoint Online进行身份验证以运行SPO cmdlet:
列出SharePoint Online中的所有网站集:
在SharePoint Online中重新创建网站集:
脚本示例– MSOL/WAAD scripts
验证到Office 365以运行MSOL / WAAD cmdlet:
获取目录中的所有用户
一个简单的MSOL示例,仅出于完整性考虑:
进一步阅读
- 使用Windows PowerShell管理Windows Azure AD
- 适用于SharePoint Online的Windows PowerShell
- 我相关的帖子- 在Office 365中的PowerShell脚本中使用CSOM
附录–SPO和MSOL / WAAD cmdlet的完整列表
为了帮助您了解每个系列中的所有命令(如果您不’还没有安装),我’m在下面列出它们:
SPO cmdlet
Add-SPOUser
连接SPO服务
断开SPOService
Get-SPOAppErrors
获取SPOAppInfo
Get-SPODeletedSite
Get-SPOExternalUser
获取-SPOSite
获取-SPOSite Group
获取点
获取点 LogEntry
获取点 LogLastAvailableTimeInUtc
Get-SPOUser
Get-SPOWebTemplate
新站点
新星集团
删除SPODeletedSite
删除-SPOExternalUser
删除-SPOSite
删除-SPOSiteGroup
删除-SPOUser
维修现场
Request-SPOUpgradeEvaluationSite
Restore-SPODeletedSite
固定位置
固定位置 Group
设定点
Set-SPOUser
测试现场
升级-现场
MSOL / WAAD cmdlet
Add-MsolForeignGroupToRole
Add-MsolGroupMember
Add-MsolRoleMember
确认-MsolDomain
Confirm-MsolEmailVerifiedDomain
Connect-MsolService
Convert-MsolDomainToFederated
Convert-MsolDomainToStandard
Convert-MsolFederatedUser
Get-MsolAccountSku
获取MsolCompanyInformation
Get-Msol联系
获取MsolDomain
获取MsolDomain FederationSettings
获取MsolDomain VerificationDns
Get-MsolFederationProperty
Get-MsolGroup
Get-MsolGroup Member
Get-MsolPartnerContract
Get-MsolPartnerInformation
Get-MsolPasswordPolicy
Get-MsolRole
Get-MsolRole Member
Get-MsolServicePrincipal
Get-MsolServicePrincipalCredential
获取Msol订阅
Get-MsolUser
Get-MsolUser ByStrongAuthentication
Get-MsolUser Role
新MsolDomain
New-MsolFederatedDomain
新玛索集团
New-MsolLicenseOptions
New-MsolServicePrincipal
New-MsolServicePrincipalAddresses
New-MsolServicePrincipalCredential
New-MsolUser
New-MsolWellKnownGroup
Redo-MsolProvision联系方式
重做-MsolProvisionGroup
Redo-MsolProvisionUser
Remove-MsolApplicationPassword
Remove-MsolContact
删除MsolDomain
Remove-MsolFederatedDomain
Remove-MsolForeignGroupFromRole
删除-MsolGroup
删除-MsolGroupMember
Remove-MsolRoleMember
Remove-MsolServicePrincipal
Remove-MsolServicePrincipalCredential
Remove-MsolUser
Reset-MsolStrongAuthenticationMethodByUpn
Restore-MsolUser
Set-MsolADFSContext
Set-MsolCompanyContactInformation
Set-MsolCompanySettings
Set-MsolDirSyncEnabled
Set-MsolDomain
Set-MsolDomain Authentication
Set-MsolDomain FederationSettings
Set-MsolGroup
Set-MsolPartnerInformation
Set-MsolPasswordPolicy
Set-MsolServicePrincipal
Set-MsolUser
Set-MsolUser License
Set-MsolUser Password
Set-MsolUser PrincipalName
Update-MsolFederatedDomain
3条评论:
克里斯,真棒。使用适用于O365 I的新cmdlet'm必须重新学习并重写许多适用于本地安装的.ps1脚本。您是否可以提供一个脚本来搜索整个网站集并报告其中的所有对象的所有唯一权限的任何提示?
@lukabrichitown,
我不'不幸的是,您没有这样的脚本,如果您需要向下列出项目/文档级别,可能是"fun"与远程API。它应该是可行的-您可能可以从我在其中显示的站点/列表迭代PS / CSOM代码开始 在Office 365中的PowerShell脚本中使用CSOM.
祝好运!
克里斯。
克里斯,你好
有没有办法"流行趋势"使用PowerShell脚本之一从SharePoint Online联机。我想从租户中获得最受欢迎(为了用户访问)或前十名网站集。
谢谢,非常感谢。
阿兰斯·雅各布
发表评论