随笔分类 -  微软Active Directory

摘要:同时给用户加入多个组,组与组之间加分号;隔开,组名要写全 阅读全文
posted @ 2020-08-26 17:31 会飞的老虎 阅读(466) 评论(0) 推荐(0)
摘要:acldiag.exe (ACL诊断,1,确定用户对AD资源是什么权限;也可重置ACL为默认状态)adsiedit.msc (ADSI编辑,2,添、删、移目录对象<含schema和配置命名上下文>;看、改、删目录对象属性)dcdiag.exe (DC诊断,1,分析在林或企业中DC的状态;报告任何错误 阅读全文
posted @ 2020-08-21 10:28 会飞的老虎 阅读(1007) 评论(0) 推荐(0)
摘要:使用Format命令格式化powershell输出,常用的命令如下: Format-Wide:每个对象仅有一个属性值被显示。默认情况下输出默认属性,也可以通过指定-Property参数来输出其他属性 例如: Get-Process -Name powershell|Format-Wide Get-P 阅读全文
posted @ 2020-08-19 15:18 会飞的老虎 阅读(2199) 评论(0) 推荐(0)
摘要:将以下脚本通过组策略设置为用户登录ps1脚本 (hostname) + ' ' + (get-wmiobject -class win32_computersystem).username >> \\fileserver\user.csv 网络路径最好是任何用户可写 同样的方法,以下脚本可以获取计算 阅读全文
posted @ 2020-08-19 11:20 会飞的老虎 阅读(2302) 评论(0) 推荐(0)
摘要:1.在C:\Program Files\WindowsPowerShell\Modules\Get-UserLogon,新建Get-UserLogon文件夹,并新建Get-UserLogon.psm1文件内容如下 function Get-UserLogon { [CmdletBinding()] 阅读全文
posted @ 2020-08-18 11:38 会飞的老虎 阅读(1809) 评论(0) 推荐(0)
摘要:$a=Read-Host "请输入要查询的用户"Get-Aduser -identity $a -Properties * | Select-Object SamAccountName,Name,DisplayName,memberof,SID,homeDirectory,Distinguished 阅读全文
posted @ 2020-08-07 15:17 会飞的老虎 阅读(2257) 评论(0) 推荐(0)
摘要:需添加活动目录模块。 要添加大量的活动目录用户,你可以从CSV文件导入用户,例如输出一个EXCEL到CSV: 接下来,代码将转换所有CSV中的数据成活动目录中用户: 1 2 3 4 5 6 7 8 9 Import-Csv -Path F:\userlist.csv -UseCulture -Enc 阅读全文
posted @ 2020-08-05 09:25 会飞的老虎 阅读(269) 评论(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 会飞的老虎 阅读(263) 评论(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)
摘要: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 会飞的老虎 阅读(741) 评论(0) 推荐(0)
摘要:$a=Read-Host "请输入要统计的用户组" $(Get-ADGroupMember $a -Recursive).count 阅读全文
posted @ 2020-07-12 19:29 会飞的老虎 阅读(1077) 评论(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 会飞的老虎 阅读(553) 评论(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 会飞的老虎 阅读(1120) 评论(2) 推荐(0)
摘要:1.导出组织架构OU的用户信息 Get-ADUser -filter * -SearchBase 'OU=test1,OU=test2,DC=domain,DC=cn' -Properties SamAccountName,DisplayName,DistinguishedName|export-c 阅读全文
posted @ 2020-07-03 11:54 会飞的老虎 阅读(1309) 评论(0) 推荐(0)