Hi i am not exactly sure if my wording is right but i need a variable which contains current date/time whenever i write data to log ; how can i do that with
wrap your two commands in function so you will have just one call ?
function add-log{ (param $txt) $DateTime = get-date | select -expand datetime Add-Content $LogFile -Value "$DateTime: $txt" }