积极答复者
本地计算机通过dos命令导出域账户信息

问题
答案
-
你好,
$Username=Get-ADUser -Identity yubin -Properties displayname| Select-Object -Property displayname |fl $date=Get-Date $SerialNumber=gwmi win32_bios | Select-Object SerialNumber|fl Write-output $Username date:$date $SerialNumber | Out-File -FilePath C:\Users\Administrator\Desktop\test02.txt
我尝试这样的powershell可以实现您的要求。
Best Regadrs,
Lee
Just do it.
- 已标记为答案 俞斌 2018年11月8日 5:45
全部回复
-
你好,
请问您需要的日期是什么日期,是账户到期日期,还是上次登录日期,或者其他什么。
共享文件夹可以直接在out-file命令后面加入你的共享文件夹路径,但是你需要确保该共享文件夹路径权限的配置是否正确。请尝试给所有人配置读写权限。
Get-ADUser -Identity yubin -Properties displayname,AccountExpirationDate | Select-Object -Property displayname,AccountExpirationDate| out-file -FilePath \\VSENSL315VM\test1\111.TXT
Best Regards,
Lee
Just do it.
-
我写的是以下脚本:
@echo off
@echo 域账户:%username% >> \\172.21.26.16\111\111.txt
@echo 日期:%date% >> \\172.21.26.16\111\111.txt
@wmic bios get SerialNumber >> \\172.21.26.16\111\111.txt
echo= >> \\172.21.26.16\111\111.txt
echo, >> \\172.21.26.16\111\111.txt
echo; >> \\172.21.26.16\111\111.txt一定要三行空格
实现这些就可以了。
-
你好,
$Username=Get-ADUser -Identity yubin -Properties displayname| Select-Object -Property displayname |fl $date=Get-Date $SerialNumber=gwmi win32_bios | Select-Object SerialNumber|fl Write-output $Username date:$date $SerialNumber | Out-File -FilePath C:\Users\Administrator\Desktop\test02.txt
我尝试这样的powershell可以实现您的要求。
Best Regadrs,
Lee
Just do it.
- 已标记为答案 俞斌 2018年11月8日 5:45