none
Trying to output a files time stamp to the same line as other information to a text file RRS feed

  • Question

  • Hello,

    I need to output to a text file,

    computer, True or false, datestamp for file

    If I put in the script

    ""$computer" + ", " + "$Test" + "," "$File.LastWriteTime" | Out-File C:\windows\temp\SMSCFG.txt -append"

    Here is the result

    "BRSP-L1BDB17, True,\\BRSP-L1BDB17\C$\Windows\SMSCFG.ini.LastWriteTime"

    What is the problem?

    $computers = Get-Content computers.txt
    $SMSCFG = "\\$computer\C$\windows\smscfg.ini"

        Foreach ($computer in $computers) {
            Write-Host = $computer
            $Test = Test-Path \\$computer\C$\windows\smscfg.ini
            $File = Get-ChildItem "\\$computer\C$\Windows\SMSCFG.ini"
            $File.LastWriteTime | Out-File C:\windows\temp\SMSCFG.txt -append
            "$computer" + ", " + "$Test" + "," + "$File.LastWriteTime" | Out-File C:\windows\temp\SMSCFG.txt -append

    }
    Write-Host "GPupdate complete"
    C:\windows\temp\SMSCFG.txt


    Michael
    Tuesday, July 12, 2011 6:27 PM

Answers

All replies