1. 批量远程修复DNS注册:
* foreach ($pc in $pcs) {.\psexec \\$pc -s "c:\windows\system32\ipconfig.exe" /registerdns}
2. 日历权限管理:
* Get-MailboxFolderPermission -Identity "m@m.com:\calendar"
* Remove-MailboxFolderPermission -Identity "hk.a@m.com:\calendar" -User "u, co"
* Set-MailboxFolderPermission -Identity ayla@contoso.com:\Calendar -User ed@contoso.com -AccessRights Editor -SharingPermissionFlags Delegate -SendNotificationToUser $true
3. 获取AAD用户信息:
Get-AzureADUser -all $true | ?{$_.displayname -like "o, M"}
4. 设置MSOL里用户的使用地 (UsageLocation):
* get-msoluser -UserPrincipalName m@a.com | fl usagelocation,country
UsageLocation : CN
Country : China
* get-msoluser -All | ft userprincipalname,usagelocation,country >> .\temp.txt
> $users = Get-Content .\temp.txt
> foreach ($u in $users) {
Get-MsolUser -UserPrincipalName $u | set-msoluser -UsageLocation "CN"
}
5。设置邮箱FA权限:
* Add-MailboxPermission -Identity "cc" -User "o, k" -AccessRights FullAccess -InheritanceType All
6. 管理邮箱的SendAs权限:
* Remove-RecipientPermission -Identity APC@d.com -AccessRights sendas -Trustee S-1-5-21-...
7. 查看目录Owner:
* GET-ACL
* (Get-ACL "AD:$((Get-ADUser username).distinguishedname)").access
8. 获取清单,利用Powershell逐个处理:
* $Users = Import-Csv "FileSystem::\\server\share\P\User.csv" | foreach { Get-*** | fl }
9. 获取设备上次启动时间:
- (gcim Win32_OperatingSystem).LastBootUpTime
- 变通一下,获取自上次重启后的运行时间:$uptime = (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
10. Win10、 Server2016/19 安装中文语言包
- 先从微软网站获取离线语言包安装文件
- 运行 DISM /online /add-package /packagepath=d:\temp\lp.cab 进行安装
- 系统设置里调整语言、地区等属性。
- 重启
11. Setspn -Q spnName --查询指定的SPN(需要知道SPN 名)
PS C:\> setspn -Q HTTP/WIN-PT4FFE #HTTP/WIN-PT4FFE是SPN名
Checking domain DC=cn-prod,DC=aaa,DC=com
CN=rs_uat,OU=...,DC=com
http/WIN-PT4FFE.cn-prod.aaa.com
http/WIN-PT4FFE

最低0.47元/天 解锁文章
2840





