question

KeithTan-7990 avatar image
0 Votes"
KeithTan-7990 asked KeithTan-7990 action

Powershell Assistance

Hi, I would really appreciate any help that I can get here. So this is the scenario. I have currently created a powershell script to capture all suspicious login. So everyday, any new entries will be edited in the original .csv file. What I would like to do is to create a copy of the original and edit the copied version and then capture all suspicious login. Everyday will be the same. Would really really appreciate any help here. Thanks!

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

VaibhavChaudhari avatar image
0 Votes"
VaibhavChaudhari answered KeithTan-7990 commented

Instead, you can copy and rename existing file to Capture_<todaysDate>.csv and run your existing code which will edit new entries in your original Capture.csv file and continue the same process everyday


Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

So what you are suggesting is to manually copy and rename the existing file? Is there an automated way to do it instead?

0 Votes 0 ·

You can use Copy-Item command

 Copy-Item "D:\Temp\Test.csv" -Destination "D:\Temp\Test_$(get-date -f yyyy-MM-dd).csv"
0 Votes 0 ·

Hi,

Sorry for the late reply. So meaning what this code will do is to create a copy first before executing the daily task?

0 Votes 0 ·