![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Conditional execution of script for logged-on user All users within domain are having common desktop (with some mandatory shortcuts/links copied through login script). I need to identify the contents (File/Folder names) on Desktops (%userprofile%\desktop) of few users (around 120) out of 1100 users. Following script outputs list of files/folders on desktop of a logged in user. I am planning to call this script in my existing login script with few modifications- 1. It will compare logged-on user with list of users stored on a shared folder 2. If the logged-on user name exists in the list, it will perform the operation of searching files on Desktop of logged-on user and output the list of files other than mandatory. 3. It will store the results in the shared folder with filename as USERNAME.LOG Script for searching files on Desktop of Logged on User- ------------------------------------- Const DESKTOP = &H10& Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(DESKTOP) Set objFolderItem = objFolder.Self Wscript.Echo objFolderItem.Path Set colItems = objFolder.Items For Each objItem in colItems Wscript.Echo objItem.Name Next ------------------------------------- Any help in this regards will be highly appreciated. Thanks.. Hemant Sarmokadam |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Conditional execution of script for logged-on user "Hemant" <Hemant@xxxxxx> wrote in message news:CEB52746-8890-478A-9EF9-B2CC9B5B79F4@xxxxxx Quote: > All users within domain are having common desktop (with some mandatory > shortcuts/links copied through login script). I need to identify the > contents > (File/Folder names) on Desktops (%userprofile%\desktop) of few users > (around > 120) out of 1100 users. Following script outputs list of files/folders on > desktop of a logged in user. I am planning to call this script in my > existing > login script with few modifications- > 1. It will compare logged-on user with list of users stored on a shared > folder > 2. If the logged-on user name exists in the list, it will perform the > operation of searching files on Desktop of logged-on user and output the > list > of files other than mandatory. > 3. It will store the results in the shared folder with filename as > USERNAME.LOG > > Script for searching files on Desktop of Logged on User- > ------------------------------------- > Const DESKTOP = &H10& > > Set objShell = CreateObject("Shell.Application") > Set objFolder = objShell.Namespace(DESKTOP) > Set objFolderItem = objFolder.Self > Wscript.Echo objFolderItem.Path > > Set colItems = objFolder.Items > For Each objItem in colItems > Wscript.Echo objItem.Name > Next > ------------------------------------- > Any help in this regards will be highly appreciated. > Thanks.. > Hemant Sarmokadam > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Conditional execution of script for logged-on user Hi Pegasus, My requirement is to get the list of files/folders on desktop of certain users. Out of 1100 users of a domain, I have to perform the search for 120 users. I do have a script (say SEARCH.VBS –given in my last post) to get this information for locally logged on user. Only thing is user need to execute it in his login. I can call SEARCH.VBS in the existing login script (which runs at startup for all users), and get the output appended in a single file on shared folder. But in that case, SEARCH.VBS will run for all 1100 users and I will further need to identify and sort required data for 120 users within the file. Hence I am looking for a script which will get executed at startup for all users, but will perform the job of searching files/folders only for 120 users. I do have list of these 120 users stored in text file on a shared folder. The script when executed at startup will compare the logged-on user with list of 120 users, if the user name matches, it will perform the search and store the result on shared folder by the name USERNAME.LOG. Hope, I have clarified my requirement. "Pegasus [MVP]" wrote: Quote: > > "Hemant" <Hemant@xxxxxx> wrote in message > news:CEB52746-8890-478A-9EF9-B2CC9B5B79F4@xxxxxx Quote: > > All users within domain are having common desktop (with some mandatory > > shortcuts/links copied through login script). I need to identify the > > contents > > (File/Folder names) on Desktops (%userprofile%\desktop) of few users > > (around > > 120) out of 1100 users. Following script outputs list of files/folders on > > desktop of a logged in user. I am planning to call this script in my > > existing > > login script with few modifications- > > 1. It will compare logged-on user with list of users stored on a shared > > folder > > 2. If the logged-on user name exists in the list, it will perform the > > operation of searching files on Desktop of logged-on user and output the > > list > > of files other than mandatory. > > 3. It will store the results in the shared folder with filename as > > USERNAME.LOG > > > > Script for searching files on Desktop of Logged on User- > > ------------------------------------- > > Const DESKTOP = &H10& > > > > Set objShell = CreateObject("Shell.Application") > > Set objFolder = objShell.Namespace(DESKTOP) > > Set objFolderItem = objFolder.Self > > Wscript.Echo objFolderItem.Path > > > > Set colItems = objFolder.Items > > For Each objItem in colItems > > Wscript.Echo objItem.Name > > Next > > ------------------------------------- > > Any help in this regards will be highly appreciated. > > Thanks.. > > Hemant Sarmokadam > > > What is your specific question? > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Conditional execution of script for logged-on user I have a strong tendency to select the simplest solution for any given problem. I know that this is a VB Scripting group but it seems that a batch file solution would be much simpler than a VB Script file, e.g. like this one: [1] @echo on [2] if exist "\\Server\Share\Folder\%UserName%.txt" goto :eof [3] type "\\Server\Share\Folder\UserList.txt" | find /i "%Username%" [4] if %ErrorLevel% GTR 0 ( [5] cd 2>"\\Server\Share\Folder\%UserName%.txt" & goto :eof [6] ) else ( [7] dir /b "%UserProfile%\Desktop" > "\\Server\Share\Folder\%UserName%.txt" [8] ) Line 2 will ensure that that this section of the batch file runs just once, regardless of which group the user belongs to. Lines 3 and 4 will check if the current user belongs to your group of 120 users. If the user does not belong to this group then Line 5 creates a zero-byte semaphore file for the benefit of Line 2 at the next logon event. Line 7 creates a directory listing of the current user's desktop. Again this will be picked up by Line 2 at the next logon event. When it's all finished and done then you can harvest your file lists from the various files on your server share. "Hemant" <Hemant@xxxxxx> wrote in message news:71F745FE-90F1-4D94-8E76-4B959B13A09A@xxxxxx Quote: > Hi Pegasus, > > My requirement is to get the list of files/folders on desktop of certain > users. Out of 1100 users of a domain, I have to perform the search for 120 > users. > I do have a script (say SEARCH.VBS -given in my last post) to get this > information for locally logged on user. Only thing is user need to execute > it > in his login. I can call SEARCH.VBS in the existing login script (which > runs > at startup for all users), and get the output appended in a single file on > shared folder. But in that case, SEARCH.VBS will run for all 1100 users > and I > will further need to identify and sort required data for 120 users within > the > file. > Hence I am looking for a script which will get executed at startup for all > users, but will perform the job of searching files/folders only for 120 > users. I do have list of these 120 users stored in text file on a shared > folder. The script when executed at startup will compare the logged-on > user > with list of 120 users, if the user name matches, it will perform the > search > and store the result on shared folder by the name USERNAME.LOG. > > Hope, I have clarified my requirement. > > "Pegasus [MVP]" wrote: > Quote: >> >> "Hemant" <Hemant@xxxxxx> wrote in message >> news:CEB52746-8890-478A-9EF9-B2CC9B5B79F4@xxxxxx Quote: >> > All users within domain are having common desktop (with some mandatory >> > shortcuts/links copied through login script). I need to identify the >> > contents >> > (File/Folder names) on Desktops (%userprofile%\desktop) of few users >> > (around >> > 120) out of 1100 users. Following script outputs list of files/folders >> > on >> > desktop of a logged in user. I am planning to call this script in my >> > existing >> > login script with few modifications- >> > 1. It will compare logged-on user with list of users stored on a shared >> > folder >> > 2. If the logged-on user name exists in the list, it will perform the >> > operation of searching files on Desktop of logged-on user and output >> > the >> > list >> > of files other than mandatory. >> > 3. It will store the results in the shared folder with filename as >> > USERNAME.LOG >> > >> > Script for searching files on Desktop of Logged on User- >> > ------------------------------------- >> > Const DESKTOP = &H10& >> > >> > Set objShell = CreateObject("Shell.Application") >> > Set objFolder = objShell.Namespace(DESKTOP) >> > Set objFolderItem = objFolder.Self >> > Wscript.Echo objFolderItem.Path >> > >> > Set colItems = objFolder.Items >> > For Each objItem in colItems >> > Wscript.Echo objItem.Name >> > Next >> > ------------------------------------- >> > Any help in this regards will be highly appreciated. >> > Thanks.. >> > Hemant Sarmokadam >> > >> What is your specific question? >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Conditional execution of script for logged-on user "Hemant" <Hemant@xxxxxx> wrote in message news:71F745FE-90F1-4D94-8E76-4B959B13A09A@xxxxxx Quote: > Hi Pegasus, > > My requirement is to get the list of files/folders on desktop of certain > users. Out of 1100 users of a domain, I have to perform the search for 120 > users. > I do have a script (say SEARCH.VBS –given in my last post) to get this > information for locally logged on user. Only thing is user need to execute > it > in his login. I can call SEARCH.VBS in the existing login script (which > runs > at startup for all users), and get the output appended in a single file on > shared folder. But in that case, SEARCH.VBS will run for all 1100 users > and I > will further need to identify and sort required data for 120 users within > the > file. > Hence I am looking for a script which will get executed at startup for all > users, but will perform the job of searching files/folders only for 120 > users. I do have list of these 120 users stored in text file on a shared > folder. The script when executed at startup will compare the logged-on > user > with list of 120 users, if the user name matches, it will perform the > search > and store the result on shared folder by the name USERNAME.LOG. > > Hope, I have clarified my requirement. to ignore those not in the list of 120. /Al Quote: > "Pegasus [MVP]" wrote: > Quote: >> >> "Hemant" <Hemant@xxxxxx> wrote in message >> news:CEB52746-8890-478A-9EF9-B2CC9B5B79F4@xxxxxx Quote: >> > All users within domain are having common desktop (with some mandatory >> > shortcuts/links copied through login script). I need to identify the >> > contents >> > (File/Folder names) on Desktops (%userprofile%\desktop) of few users >> > (around >> > 120) out of 1100 users. Following script outputs list of files/folders >> > on >> > desktop of a logged in user. I am planning to call this script in my >> > existing >> > login script with few modifications- >> > 1. It will compare logged-on user with list of users stored on a shared >> > folder >> > 2. If the logged-on user name exists in the list, it will perform the >> > operation of searching files on Desktop of logged-on user and output >> > the >> > list >> > of files other than mandatory. >> > 3. It will store the results in the shared folder with filename as >> > USERNAME.LOG >> > >> > Script for searching files on Desktop of Logged on User- >> > ------------------------------------- >> > Const DESKTOP = &H10& >> > >> > Set objShell = CreateObject("Shell.Application") >> > Set objFolder = objShell.Namespace(DESKTOP) >> > Set objFolderItem = objFolder.Self >> > Wscript.Echo objFolderItem.Path >> > >> > Set colItems = objFolder.Items >> > For Each objItem in colItems >> > Wscript.Echo objItem.Name >> > Next >> > ------------------------------------- >> > Any help in this regards will be highly appreciated. >> > Thanks.. >> > Hemant Sarmokadam >> > >> What is your specific question? >> >> >> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Conditional execution of script for logged-on user Thanks a lot Pegasus!!! It worked!! Thank you very much for your time and fast solution. -Hemant "Pegasus [MVP]" wrote: Quote: > > "Hemant" <Hemant@xxxxxx> wrote in message > news:CEB52746-8890-478A-9EF9-B2CC9B5B79F4@xxxxxx Quote: > > All users within domain are having common desktop (with some mandatory > > shortcuts/links copied through login script). I need to identify the > > contents > > (File/Folder names) on Desktops (%userprofile%\desktop) of few users > > (around > > 120) out of 1100 users. Following script outputs list of files/folders on > > desktop of a logged in user. I am planning to call this script in my > > existing > > login script with few modifications- > > 1. It will compare logged-on user with list of users stored on a shared > > folder > > 2. If the logged-on user name exists in the list, it will perform the > > operation of searching files on Desktop of logged-on user and output the > > list > > of files other than mandatory. > > 3. It will store the results in the shared folder with filename as > > USERNAME.LOG > > > > Script for searching files on Desktop of Logged on User- > > ------------------------------------- > > Const DESKTOP = &H10& > > > > Set objShell = CreateObject("Shell.Application") > > Set objFolder = objShell.Namespace(DESKTOP) > > Set objFolderItem = objFolder.Self > > Wscript.Echo objFolderItem.Path > > > > Set colItems = objFolder.Items > > For Each objItem in colItems > > Wscript.Echo objItem.Name > > Next > > ------------------------------------- > > Any help in this regards will be highly appreciated. > > Thanks.. > > Hemant Sarmokadam > > > What is your specific question? > > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Conditional execution of script for logged-on user "Hemant" <Hemant@xxxxxx> wrote in message news:ADF43283-874B-4A44-B294-B615176541CB@xxxxxx Quote: > Thanks a lot Pegasus!!! > It worked!! Thank you very much for your time and fast > solution. > > -Hemant > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Conditional execution based on app configuration | .NET General | |||
| Script to find all user and what PC they are logged into | VB Script | |||
| Script Execution Over Network | VB Script | |||
| User Profile Bad if this user is not first user logged onto Vista | Vista account administration | |||
| Terminate Script Execution? | PowerShell | |||