วันพฤหัสบดีที่ 6 กรกฎาคม พ.ศ. 2560

Scripts Power Shell :Loop For Check User last logon


Scripts Power Shell :Loop For Check User use Computer


###-----------------------------------------------------------###
###--------Author : Mr.Yingkamol Prukrattanakul----###
###---MCP, MCSA, MCSE, MCT, MCST, SEC+----###
###------Email<yingkamol_7@hotmail.com>--------###
###----------------------------------------------------------###
###/////////////////////////////..........\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\###
###///////////////////////////////......\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\###

function GetUserUseComputer

{
$computers = Get-Content D:\IPlist.csv
$ondate = get-date -Format "ddMMyy"



ForEach ($computer in $computers)
{

  try
    {
Get-WmiObject –ComputerName $computer –Class Win32_ComputerSystem | Select-Object Name,UserName
}

catch    
{
            $NOTCONNECT= "System NOPATCH:$computer"
            $NOTCONNECT| Write-Warning
            $NOTCONNECT>> "$env:USERPROFILE\Desktop\NOTCONNECT.txt"

    }
}

}


GetUserUseComputer> "$env:USERPROFILE\Desktop\GetUserUseComputer$ondate.txt"

ไม่มีความคิดเห็น:

แสดงความคิดเห็น