Jump to content

Remove icons in different accounts


Recommended Posts

hi

I'm using my unattended installation to install new computers

with this, useraccounts.cmd is read from the floppy

every computer has different user accounts.. so :)

There are some icons I want to remove from the quick launch menu, desktop or start-menu

but I want to do this with an batchfile

Is there a variable or key, so icons can be removed from every account? (and not in the AllUsers!)

tnx :hello:

Link to comment
Share on other sites


There isn't a variable or key that I know of, but you should still be able to do it with a fairly simple script. Create an additional file on your floppy called Users.txt. Put a list of users in it, one per line, as such:

Users.txt

User1
User2
User3
User4

Then use a simple for loop to do each of the required deletions like so:

FOR /f %%f in ('type a:\users.txt') DO (
del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk"
)

This example should delete the Sample Pictures from every user's My Pictures folder. Use of %allusersprofile%\.. ensures that the command will target the proper file regardless of whether or not the Documents and Settings folder has been moved from its default spot on the system drive. Otherwise, %systemdrive%\Documents and Settings\%%f\... can also be used.

Hope this is clear, since I'm writting it after being awake almost 24 straight hours. I'm heading to bed as soon as this is posted. ;)

Link to comment
Share on other sites

There isn't a variable or key that I know of, but you should still be able to do it with a fairly simple script. Create an additional file on your floppy called Users.txt. Put a list of users in it, one per line, as such:

User1
User2
User3
User4

Then use a simple for loop to do each of the required deletions like so:

FOR /f %%f in ('type a:\users.txt') DO (
del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk"
)

This example should delete the Sample Pictures from every user's My Pictures folder. Use of %allusersprofile%\.. ensures that the command will target the proper file regardless of whether or not the Documents and Settings folder has been moved from its default spot on the system drive. Otherwise, %systemdrive%\Documents and Settings\%%f\... can also be used.

Hope this is clear, since I'm writting it after being awake almost 24 straight hours. I'm heading to bed as soon as this is posted. ;)

hmm that a good way :)

but can't I make a file, so he'll take every account? no matter what name it is?

I'll be glad to hear it, because there are a lot of last names here in Holland :)

Link to comment
Share on other sites

You could try this. Essentially the same for loop, just taking the input from a different location.

FOR /f "tokens=*" %%f in ('dir /ad /b "%allusersprofile%\.."') DO (
del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk"
)

Since I assume you have to manually create the useraccounts.cmd file to be placed on the floppy, you could replace that script with a user.txt file and then create a single useraccounts.cmd that would then sit on the uA CD itself.

Users.txt

User1 password group
User2 password group
User3 password group
User4 password group

Useraccounts.cmd(on CD)

if exist A:\Users.txt (
for /f "tokens=2,3,4*" %%f in ('type A:\Users.txt') do (
net user %%f %%g /add
net localgroup %%h %%f /add
)
)

You can then call the delete script using the same Users.txt file as coded in my first post. If you are using custom groups for your setup, you can create those from a text file with a for loop on your uA CD too.

Groups.txt

Group1 comment
Group2 comment
Group3 comment
Group4 comment

AddGroups.cmd(on CD)

if exist A:\Groups.txt (
for /f "tokens=2*" %%f in ('type A:\Groups.txt') do (
net localgroup %%f /COMMENT:"%%g" /add
)
)

The only downside I can see to doing it this way is that you can't create users or groups with spaces in them. Then again, I don't really see why you would want to anyway. ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...