#145753 - 2005-08-17 11:33 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
okay, i got it. i changed what it is reading in the reg to the actual personal key and looking for value r:\. that did it. you're a genious!
|
Top
|
|
|
|
#145754 - 2005-08-18 01:11 PM
Re: Move My Documents via writevalue
|
jon02
Lurker
Registered: 2005-08-18
Posts: 1
Loc: Switzerland
|
rtfm
|
Top
|
|
|
|
#145756 - 2005-08-18 10:25 PM
Re: Move My Documents via writevalue
|
Co
MM club member
 
Registered: 2000-11-20
Posts: 1342
Loc: NL
|
|
Top
|
|
|
|
#145757 - 2005-08-24 07:02 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
mart, i hope you're still monitoring this post because i've got another challenge i need help with and you are the man! btw, the script you wrote for me above is solid and works perfectly.
i now need, in addition to the above, to be able to identify which users have a My Documents folder still assigned to their C:\ drive (since the location is c:\Documents and Settings\etc\etc..., we would need to search just the beginning of the script for a match on C:\). once the script determines who is using C: as their My Documents location, i need to write that output, including the userid and date/time to a network shared file. it would have to allow mutliple entries as i need to gather this info for all users who log on.
in addition to that, i'd like to know which users are using offline files (synchronization) and write that to a different file.
are these things possible? if so, can you help me? thanks in advance - you are the bomb!
|
Top
|
|
|
|
#145758 - 2005-08-24 08:35 PM
Re: Move My Documents via writevalue
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
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)
Edited by Mart (2005-08-24 09:48 PM)
|
Top
|
|
|
|
#145759 - 2005-08-24 09:32 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
hi. is there supposed to be a ')' at the end of these lines? i am getting an error in that part of the script. thanks guru!
$rc = WriteLine (1, @TIME + " " + @DATE + @CRLF $rc = WriteLine (1, "Location of My Documents for user " + @USERID + " is NOT ok." + @CRLF $rc = WriteLine (1, "---------------------------------------" + @CRLF
|
Top
|
|
|
|
#145760 - 2005-08-24 09:43 PM
Re: Move My Documents via writevalue
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
DOH!  Yep there should be a ) after each @crlf. Damn those typo's.
[edit august 24 21:32] Corrected code above. [/edit]
Edited by Mart (2005-08-24 09:49 PM)
|
Top
|
|
|
|
#145761 - 2005-08-24 10:01 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
awesome, the only tweak left is i need for it to look for C:\ in the My Documents field because i am going to gather these statistics prior to rolling out the script that modifies their My Doc location. actually, there is a default string setting i think for that. maybe we can use that?
|
Top
|
|
|
|
#145762 - 2005-08-24 10:20 PM
Re: Move My Documents via writevalue
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
Ah...ok. Then just change this:
Code:
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
to this:
Code:
Select Case $Redirected <> "%USERPROFILE%\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 = "%USERPROFILE%\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
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
Top
|
|
|
|
#145763 - 2005-08-24 11:33 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
you know what's weird? the log file is showing the response for just the first case section in each of the writeline sections. in other words, if you are or are not using offline files, it says you are. if you are or are not using C:\Documents and Settings\etc., it says you are not. seems as if the logic is a little off. does this need to run with the other script you sent from before or they can operate as two independant scripts? thanks!
|
Top
|
|
|
|
#145764 - 2005-08-25 01:54 AM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
correction. the log file is reporting the offline files correctly. however, the my docs part is incorrectly reporting that is not being used, even it is is. i think we need double % maybe like: %%USERPROFILE%%\My Documents???
|
Top
|
|
|
|
#145765 - 2005-08-25 05:32 PM
Re: Move My Documents via writevalue
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
okay, the script works fine after adding double %. however, since offline files is enabled by default in xp, we are finding that everyone's value is set to 1. i guess what we were are trying to measure if whether or not it's actually being used. is there a way we can tell that from the reg? maybe we can check for the presence of an offline folder on their system? this most likely is stored in the reg somewhere. thanks in advance. you are saving me all kinds of headache!
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 202 anonymous users online.
|
|
|