摘要: Get-ADUser -filter * -SearchBase 'OU=aaaaaa,OU=aaaa,OU=aaaaa,DC=test,DC=cn' -Properties *|Get-ADUser -Properties Mail | Select-Object Name,Mail |expor 阅读全文
posted @ 2020-07-12 23:08 会飞的老虎 阅读(261) 评论(0) 推荐(0)
摘要: Get-ADGroupMember -Identity group1 -Recursive | Get-ADUser -Properties Mail | Select-Object Name,Mail |export-csv D:\groupdetail.csv –NoTypeInformatio 阅读全文
posted @ 2020-07-12 23:03 会飞的老虎 阅读(168) 评论(0) 推荐(0)
摘要: "Get-ADComputer -Filter * -SearchBase ""OU=XXX,DC=TEST,DC=cn"" -Properties * | select lastLogon, lastLogonTimestamp | export-csv C:\Computers.csv -NoT 阅读全文
posted @ 2020-07-12 21:41 会飞的老虎 阅读(262) 评论(0) 推荐(0)
摘要: Get-MailboxDatabase HR | Set-MailboxDatabase -PublicFolderDatabase PublicXXX 阅读全文
posted @ 2020-07-12 21:36 会飞的老虎 阅读(171) 评论(0) 推荐(0)
摘要: Get-ADUser -Filter {Enabled -eq "False"} |select UserPrincipalName |Export-Csv Disable.csv -encoding utf8 阅读全文
posted @ 2020-07-12 21:00 会飞的老虎 阅读(523) 评论(0) 推荐(0)
摘要: 批量迁移用户到数据库,user.txt表中,只包含用户名一列 Get-Content c:\user.txt | Get-mailbox | new-moveRequest -TargetDatabase 数据库名 阅读全文
posted @ 2020-07-12 20:58 会飞的老虎 阅读(853) 评论(0) 推荐(0)
摘要: Get-Mailbox -ResultSize Unlimited| Get-Mailboxstatistics | where-object {$_.LastLogonTime -lt (get-date).AddDays(-30)} |select DisplayName,TotalItemSi 阅读全文
posted @ 2020-07-12 20:55 会飞的老虎 阅读(345) 评论(0) 推荐(0)
摘要: 当数据库挂载不上时使用 mount-database –Identity 200MB_DB01 -Force 阅读全文
posted @ 2020-07-12 20:53 会飞的老虎 阅读(928) 评论(0) 推荐(0)
摘要: 邮箱数据库整理,查询邮箱数据库大小和空白数据大小AvailableNewMailboxSpace是指的这个总空间里可以被“减肥”掉的空间。 Get-MailboxDatabase db0* -Status | FT Name,@{n="MailboxCount";e={(Get-Mailbox -D 阅读全文
posted @ 2020-07-12 20:49 会飞的老虎 阅读(464) 评论(0) 推荐(0)
摘要: Get-Mailbox -ResultSize Unlimited | select DisplayName,PrimarySmtpAddress,@{label="TotalItemSize";expression={(Get-MailboxStatistics $_.Name).TotalIte 阅读全文
posted @ 2020-07-12 20:42 会飞的老虎 阅读(468) 评论(0) 推荐(0)
摘要: 查询用户某个时间段发件记录,需要Organization Management组权限 Get-MessageTrackingLog -Server Mail -ResultSize unlimited -Start "09/22/2014 09:00:00" -End "09/25/2014 18: 阅读全文
posted @ 2020-07-12 20:33 会飞的老虎 阅读(178) 评论(0) 推荐(0)
摘要: "import-csv -path C:\mac.csv | foreach { $a=$_.name Get-DhcpServerv4Scope | Get-DhcpServerv4Lease |where {$_.ClientId -like ""$a"" }} | export-csv c:\ 阅读全文
posted @ 2020-07-12 20:23 会飞的老虎 阅读(599) 评论(0) 推荐(0)
摘要: $a=Read-Host "请输入账号" remove-adgroupmember -identity group01 -members $a -confirm:$false #把用户从group01移除Add-ADGroupMember -identity group11111 -members 阅读全文
posted @ 2020-07-12 20:05 会飞的老虎 阅读(411) 评论(0) 推荐(0)
摘要: 1.powershell循环调用CSV文件 Import-Csv -Path E:\work\AD\0708\m.csv | foreach { $a=$_.name #定义$a等于CSV文件中的变量,有时候直接写$_.name 无法被识别 ………………………………} 2.调用用户输入的变量 $a= 阅读全文
posted @ 2020-07-12 19:35 会飞的老虎 阅读(740) 评论(0) 推荐(0)
摘要: $a=Read-Host "请输入要统计的用户组" $(Get-ADGroupMember $a -Recursive).count 阅读全文
posted @ 2020-07-12 19:29 会飞的老虎 阅读(1076) 评论(0) 推荐(0)
摘要: 批量导出AD用户的最后一次登录时间 import-csv -path c:\test.csv |%{get-aduser $_.SamAccountName -Properties lastlogon} | select SamAccountName, @{n="Lastlogon";e={[dat 阅读全文
posted @ 2020-07-12 19:24 会飞的老虎 阅读(552) 评论(0) 推荐(0)
摘要: 从组中移除用户 Remove-adgroupmember -identity group02 -members san_zhang 批量移除组中的用户for /f ""skip=1 eol=;tokens=1-3 delims=,"" %%a in (E:\disuser.csv) do forea 阅读全文
posted @ 2020-07-12 19:01 会飞的老虎 阅读(1116) 评论(2) 推荐(0)