Closed

Powershell expert to modify logon/logoff script

I have a script written that shows the logon/logoff of users from a Virtual machine. I want to modify this script to show not just the logon/logoff times but also the duration. This will be achieved by subtracting the login time from the logoff time and displaying the time in hours.

<#

.SYNOPSIS

Logon/logoff

.DESCRIPTION

Logon/logoff durations

Gets the logon/logoff times of any desired machine

.NOTES

Created: 2019-09-24

Author: Servo

This script is provided 'AS IS' with no warranties, confers no rights and is not supported by the author.

0.1

Initial Version

#>

[CmdletBinding()]

Param (

[string]$Computer = $env:computername,

[int]$Days = 7,

[string]$destinationpath = "\\tig\sor$\mdd\logOn_logOff",

[String]$Path = "c:\temp\"

)

cls

$Result = @()

Write-Host "Gathering Event Logs, this can take a while..."

$ELogs = Get-EventLog System -Source Microsoft-Windows-WinLogon -After (Get-Date).AddDays(-$Days) -ComputerName $Computer

If ($ELogs)

{ Write-Host "Processing..."

ForEach ($Log in $ELogs)

{ If ($[login to view URL] -eq 7001)

{ $ET = "Logon"

}

ElseIf ($[login to view URL] -eq 7002)

{ $ET = "Logoff"

}

Else

{ Continue

}

$Result += New-Object PSObject -Property @{

Time = $[login to view URL]

'Event Type' = $ET

User = (New-Object [login to view URL] $[login to view URL][1]).Translate([[login to view URL]])

}

}

$Result | Select Time,"Event Type",User | Sort Time -Descending | Export-CSV "$Path\report_$($env:computername)_$(Get-Date -Format yyyyMMdd-hhmmss).csv" -NoTypeInformation -Force

$filename = "report_$($env:computername)_$(Get-Date -Format yyyyMMdd-hhmmss).csv"

copy-Item -Path "c:\Temp\$filename" -Destination "$destinationpath\$filename" -Force

Write-Host "Done."

}

Else

{ Write-Host "Problem with $Computer."

}

Skills: Shell Script, Powershell, Software Architecture, Windows Server, Script Install

See more: modify popup window script, add modify remove hphp script, modify sql table script, oscommerce logon logoff button, modify attributes user script excel, java script hours count counter, windows logon timer script, automatic logon websites script, css modify associate matic script, modify install website script, linux varlogmessages bash script hours, post logon vbs script sample, help modify xml file script, modify python feedback script, modify xml values script windows, modify xml file script, modify logon screen, modify file python script, agree terms logoff script, modify attribute user script

About the Employer:
( 2 reviews ) Hamburg, Germany

Project ID: #21571027

11 freelancers are bidding on average $28 for this job

goodwork20k

I am good in powershell script along with automation, please let me know if you are good to award this project to me

$30 USD in 2 days
(20 Reviews)
4.8
writingapp

Hi. Great app writer for your projects. I have writen .net, c#, powershell, scraping, excel, googlesheet, csv, database app, macro, vba for many years. I am ready to write your project. Thank you for visiting my profil More

$30 USD in 2 days
(5 Reviews)
2.7
AdrianCJ

I can modify your script to determine the duration of the login and add it to the *.CSV file that is already created. Please let me know if the sorting stays the same or sorting by the duration time would be preferred More

$25 USD in 2 days
(5 Reviews)
2.3
hieuttmmo

I have been working as System Engineer for 4 years. I have experience in scripting language like Python, shell script like Bash shell, Powershell... With your requirements I know I could solve it quickly and make it ru More

$25 USD in 1 day
(2 Reviews)
1.8
krishsathish02

Hi Client , My name is Krish. I’m a Senior Software Developer & Freelance Web & Automation developer with 4+ years of experiences with Master degree holder and expertise in PYTHON, PHP, HTML 5, CSS3, JAVASCRIPT, More

$10 USD in 1 day
(1 Review)
0.4
utkarshdubeyg

Hi, Hope you are doing well. I have experience in writing PowerShell scripts. Looking forward to working with you. Regards

$50 USD in 1 day
(0 Reviews)
0.0
cybr27

If you could share your script, I will do the modification that fits for requirement. Looking forward to work

$10 USD in 7 days
(0 Reviews)
0.0
Mohsen2004

I can write this program for you in c # a day But editing the previous code has more trouble Chat with me if you would like to rewrite the program

$55 USD in 1 day
(1 Review)
0.0
rajatk2313

I am expertise in powershell. scripting. I have already created so many logon and logoff powershell scripts. Its nyc to working with you

$25 USD in 1 day
(0 Reviews)
0.0
DummyLearns

If you have challenge, .. I have talent.. Test My Skills, and you will never regret ! This stuff is nothing more than the daily BAU which I deliver with Excellence,...... Everyday !!! #8+ Years Experience #Technical More

$28 USD in 1 day
(0 Reviews)
0.0
(0 Reviews)
0.0