跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • A1全局管理批量撸资账户脚本Office 365 PowerShell
未分類
7 2 月 2020

A1全局管理批量撸资账户脚本Office 365 PowerShell

口吐芬芳 大佬有话说 :

A1全局管理批量撸资账户脚本Office 365 PowerShell

连接到 Office 365 PowerShell
步骤 1:安装所需软件
这些步骤只需在您的计算机上执行一次即可,而不是在每次连接时都要求执行。但是,您可能需要定期安装较新版本的软件。
安装 64 位版 Microsoft Online Services 登录助手:适用于 IT 专业人员 RTW 的 Microsoft Online Services 登录助手。
安装用于 Windows PowerShell 的 Microsoft Azure Active Directory 模块,具体步骤如下:
打开提升的 Windows PowerShell 命令提示符(以管理员身份运行 Windows PowerShell)。
运行 Install-Module MSOnline 命令。
如果系统提示安装 NuGet 提供程序,请键入 Y,然后按 Enter 键。
如果系统提示从 PSGallery 安装模块,请键入 Y,然后按 Enter 键。

步骤 2: 连接到 Office 365 订阅 Azure AD
请从 Windows PowerShell 命令提示符 (它没有要提升的权限) 运行以下命令:

Connect-MsolService

登录到您的帐户对话框中,键入您的 Office 365 工作或学校帐户的用户名和密码,,然后单击确定。

查看订阅SKU
运行命令:
Get-MsolAccountSku

准备账号文本
本示例从名为 C:My DocumentsNewAccounts.csv 的文件创建用户帐户,并将结果记录在名为 C:My DocumentsNewAccountResults.csv 的文件中

UserPrincipalName        FirstName        LastName        DisplayName        UsageLocation        AccountSkuId
[email protected]        Claude        Loiselle        Claude Loiselle        US        contoso:ENTERPRISEPACK
[email protected]        Lynne        Baxter        Lynne Baxter        US        contoso:ENTERPRISEPACK
[email protected]        Shawn        Melendez        Shawn Melendez        US        contoso:ENTERPRISEPACK
创建NewAccounts.csv
里面包含

使用 Office 365 PowerShell 创建多个用户帐户
输入命令

Import-Csv -Path "C:NewAccounts.csv" | foreach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId} | Export-Csv -Path "C: NewAccountResults.csv"
账号写入:
Import-Csv -Path "C:NewAccounts.csv" | foreach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId} | Export-Csv -Path "C:NewAccountResults.csv"

删除所有账号脚本(谨慎操作):

$users = Get-MsolUser -All
$users | Remove-MsolUser –Force

bhgchinaboy 大佬有话说 :

谢谢大佬

但是我以为是撸全局的

tssz 大佬有话说 :

之前论坛有人开车,结果我现在忘记密码了。

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具