Page 2 of 4 <1234>
Topic Options
#145752 - 2005-08-17 11:06 PM Re: Move My Documents via writevalue
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

there are a couple of questions now:

1. i changed the mapping to my docs on the desktop and the value was rewritten in to the reg. however, when i logged out and back in, it said no changes were necessary and therefore, did not change the docs back to R:\. what is it reading to determine whether or not a change is needed?





$Redirected = ReadValue ($Key, "My Docs and My Pics redirected")

Quote:


2. what does the md command do? make directory?





Yep.

Quote:


3. i pulled out this section: $rc = ReadValue ("subkey", "entry")If $rc <> "R:\" WriteValue ("subkey", "entry", "expression", "data type") $kill= EnumProcess("explorer.exe",1)Else ?"No changes needed skipping to end."EndIf.

does it need to be left in?





DO NOT pull anything out. Just copy the script as posted above (not the top one but the one below "Hold your horse....") and its ready for use.

Sorry. My bad. Change this:

Code:

Case 1
?"No changes needed.



to this:

Code:

Case $Redirected = "Yes"
?"No changes needed.



Edited by Mart (2005-08-17 11:10 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145753 - 2005-08-17 11:33 PM Re: Move My Documents via writevalue
endodave Offline
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 Offline
Lurker

Registered: 2005-08-18
Posts: 1
Loc: Switzerland
rtfm
Top
#145755 - 2005-08-18 07:37 PM Re: Move My Documents via writevalue
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Wow, such a nice FIRST POST
Top
#145756 - 2005-08-18 10:25 PM Re: Move My Documents via writevalue
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Yeah, more of this kind of posts!! refreshing...
_________________________
Co


Top
#145757 - 2005-08-24 07:02 PM Re: Move My Documents via writevalue
endodave Offline
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 Moderator Offline
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 Offline
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 Moderator Offline
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 Offline
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 Moderator Offline
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 Offline
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 Offline
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 Offline
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
#145766 - 2005-08-25 05:47 PM Re: Move My Documents via writevalue
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well...
xp does use the offline store even though the user does not want.
specially if you have w2k system updated to xp.
_________________________
!

download KiXnet

Top
#145767 - 2005-08-25 08:14 PM Re: Move My Documents via writevalue
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I just did a regshot before and after enabling offline files.
This is what came out:

Quote:


REGSHOT LOG 1.61e5

Comments:
Datetime:2005/8/24 17:55:30 , 2005/8/24 17:55:49
Computer:CHALLENGER , CHALLENGER
Username: ,

----------------------------------
Keys added:2
----------------------------------

HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\AssignedOfflineFolders

----------------------------------
Values added:9
----------------------------------

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\Enabled: 0x00000001
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\DefCacheSize: 0x000003EA
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\SyncAtLogon: 0x00000000
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\SyncAtLogoff: 0x00000001
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\NoReminders: 0x00000000
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\ReminderFreqMinutes: 0x0000003C
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\AdminPinStartTime: E8 28 7D 09 D5 A8 C5 01
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\PinCountsReset: 0x00000001
HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\AdminPinFinishTime: E8 28 7D 09 D5 A8 C5 01

----------------------------------
Values modified:1
----------------------------------

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed: C1 7E D7 17 71 8E 23 D3 BE 9F 7C DB F1 E0 F1 5B 8E A9 A5 1D F8 A8 6C 9B 50 FB 2B 41 94 71 C5 4D 38 BF B7 AE 8E 8C 1D 68 93 32 E5 44 32 B7 80 DF AA F3 F1 3D 3B A0 3B 37 9D 44 77 2A FA 44 A3 7D 9A 29 26 CA BD F9 6D C1 C5 D8 53 DA D7 2D 5E F9
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed: C5 21 2C 32 44 E2 ED 0F BE D9 31 4E 66 79 7A 6D 58 F0 9C 03 DF 2B 7C 91 D8 87 95 87 7F 32 BF B1 B3 AE 46 02 00 C1 A6 41 F6 1A 51 A5 C2 5C 62 61 EF 9F 54 81 54 37 D6 89 2B 9F A1 0F 8A 8A B8 7B D1 1B BF 3A 97 5F FE 1B 59 DC 2F BF BA 26 12 CB
----------------------------------
Total changes:12
----------------------------------





Maybe something can be done with this key:

Quote:


HKEY_USERS\S-1-5-21-725345543-1078145449-2147133589-1003\Software\Microsoft\Windows\CurrentVersion\NetCache\AssignedOfflineFolders





Just thinking if offline files is enabled but no folder have been assigned..........
Cant test now unfortunately.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145768 - 2005-08-25 09:29 PM Re: Move My Documents via writevalue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Those keys are unique to you. I don't have them on my box.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#145769 - 2005-08-25 09:32 PM Re: Move My Documents via writevalue
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This
Quote:


S-1-5-21-725345543-1078145449-2147133589-1003




should be the only part that is unique and can be replaced by @SID afaik.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145770 - 2005-08-25 10:12 PM Re: Move My Documents via writevalue
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
RegShot supplies the SID which is Current User

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\NetCache\AssignedOfflineFolders

Top
#145771 - 2005-08-25 10:25 PM Re: Move My Documents via writevalue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, I know and I believe Mart knows, but is simply too lazy to edit the result.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 2 of 4 <1234>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 202 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.076 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org