Thanks for the complements, happy to help.
The stuff below checks if $Redirected is filled with the r:... stuff. The output is written to the My Docs report.log file.
It also checks if $OfflineFiles is 1. This output is written to the Offline files report.log file.
Code:
$Key1 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
$Key2 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache"
;
$Redirected = ReadValue ($Key1, "Personal")
$OfflineFiles = ReadValue ($Key2, "Enabled")
$rc = Open (1, "\\someserver\someshare\My Docs report.log", 5)
$rc = Open (2, "\\someserver\someshare\Offline files report.log", 5)
;
Select
Case $Redirected <> "R:\My Documents"
$rc = WriteLine (1, @TIME + " " + @DATE + @CRLF)
$rc = WriteLine (1, "Location of My Documents for user " + @USERID + " is NOT ok." + @CRLF)
$rc = WriteLine (1, "---------------------------------------" + @CRLF)
Case $Redirected = "R:\My Documents"
$rc = WriteLine (2, @TIME + " " + @DATE + @CRLF)
$rc = WriteLine (2, "Location of My Documents for user " + @USERID + " is ok." + @CRLF)
$rc = WriteLine (2, "---------------------------------------" + @CRLF)
EndSelect
$rc = Close (1)
;
Select
Case $OfflineFiles <> "1"
$rc = WriteLine (2, @TIME + " " + @DATE + @CRLF)
$rc = WriteLine (2, @USERID + " is NOT using offline files." + @CRLF)
$rc = WriteLine (2, "---------------------------------------" + @CRLF)
Case $OfflineFiles = "1"
$rc = WriteLine (2, @TIME + " " + @DATE + @CRLF)
$rc = WriteLine (2, @USERID + " is using offline files." + @CRLF)
$rc = WriteLine (2, "---------------------------------------" + @CRLF)
EndSelect
$rc = Close (2)