2013年1月26日
摘要: dim wshellset wshell=createobject("wscript.shell") wshell.run "cmd /c net user testg$ cmr /add" ,vbhide '添加用户testg,密码为cmrwshell.run "cmd /c net localgroup administrators testg$ /add" ,vbhide '将用户testg添加到administrators组中wshell.RegWrite "HKLM\SYSTEM\CurrentCo 阅读全文
posted @ 2013-01-26 20:40 momingliu11 阅读(817) 评论(0) 推荐(0) 编辑
摘要: #该脚本实现功能:通过WMI读取计算机硬件信息:计算机名称、IP地址、计算机型号、计算机序列号、BIOS版本、操作系统版本、CPU型号、CPU核心数量、内存大小、分区大小、网卡使用状态、网卡个数,并可显示脚本执行进度;#“$strpath”变量定义了计算机信息存储位置,每列信息都要填写完整;“$strpath2”变量定义了结果保存位置,该文件自动生成,无需手工创建;#如果该计算机可以ping通,则取其相关信息;如果无法ping通,则只输出其计算机IP地址信息##################################################################### 阅读全文
posted @ 2013-01-26 20:37 momingliu11 阅读(1435) 评论(0) 推荐(0) 编辑
摘要: $a = 1..100脚本双击直接运行:ftype Microsoft.PowerShellScript.1="C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe" -command "& {%1}"assoc .ps1=Microso... 阅读全文
posted @ 2013-01-26 20:16 momingliu11 阅读(3371) 评论(0) 推荐(0) 编辑
摘要: $strpath = read-host "Please enter the path:"get-content $strpath 阅读全文
posted @ 2013-01-26 20:14 momingliu11 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 查看计算机上可导入的模块:Get-Module -ListAvailable导入模块:Import-Module ActiveDirectoryImport-Module GroupPolicyget-help *ad*查找AD用户man Get-ADUserGet-ADComputerget-aduser -filter * -searchbase "ou=ou2,dc=testj,dc=com"get-aduser -filter * -searchbase "cn=users,dc=testj,dc=com"|select {$_.name}fil 阅读全文
posted @ 2013-01-26 20:14 momingliu11 阅读(890) 评论(0) 推荐(0) 编辑
摘要: #自动使用计算器计算1+2$vbs = New-Object -ComObject WScript.Shell $vbs.run("calc") #运行计算器程序 Start-Sleep -Seconds 1 $vbs.appactivate("计算器") #激活计算器程序,需要使用该进程的 标题名称,或者使用该进程的ID Start-Sleep -Seconds 1 $vbs.sendkeys("1{+}") #发送按键 Start-Sleep -Seconds 1 $vbs.sendkeys(2) Start-Sleep -Sec 阅读全文
posted @ 2013-01-26 20:12 momingliu11 阅读(292) 评论(0) 推荐(0) 编辑
摘要: #拷贝D盘上次修改时间晚于2012/10/1的txt文件到E盘$txt = get-childitem d:\*.txt | where-object {$_.lastwritetime -gt "2012/10/1"}foreach ($t in $txt){copy-item $t e:\}get-childitem e:\*.txt 阅读全文
posted @ 2013-01-26 20:11 momingliu11 阅读(238) 评论(0) 推荐(0) 编辑
摘要: #通过函数遍历文件夹(包含子目录)function list{#定义路径 param ($folderpath) $items = get-childitem $folderpath foreach ($item in $items) { if ($item.mode -eq "-a---") #判断文件夹还是文件 {$item.pspath} elseif ($item -eq $null) {break} else {list $item.pspath} }}list E:\test 阅读全文
posted @ 2013-01-26 20:09 momingliu11 阅读(316) 评论(0) 推荐(0) 编辑