Sign in to follow this  
Followers 0
surreal

edit win.ini

11 posts in this topic

ok, first i would like to say thanks for your help with this.

i need to change just a part of the win.ini on our xp systems. the problem is that a lot of users win.ini are different, so the line numbers that i need to edit are always going to be different.

example:

; for 16-bit app support

[fonts]

[extensions]

[mci extensions]

[files]

[Mail]

MAPI=1

CMC=1

CMCDLLNAME=mapi.dll

CMCDLLNAME32=mapi32.dll

MAPIX=1

MAPIXVER=1.0.0.1

OLEMessaging=1

[MCI Extensions.BAK]

aif=MPEGVideo

aifc=MPEGVideo

aiff=MPEGVideo

asf=MPEGVideo

asx=MPEGVideo

au=MPEGVideo

[CKSN]

winNT=open

the part i need to change is the [mail]

i would like to delete whatever they have and add my own entrys to everyone. is there a way to define just the [mail] part? if they have by chance a few [fonts] setting or [files] setting that changes the lines i need to edit.

thanks again everyone for all your help...

d@ve

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

IniReadSection() Would suit your needs.

IniWrite()

IniDelete()

Edited by Alienware

Share this post


Link to post
Share on other sites

that was easy enough thanks for the help, sorry for the lame question...

IniDelete("C:\windows\win.ini", "mail")

IniWrite("C:\windows\win.ini", "mail", "MAPI", "1")

IniWrite("C:\windows\win.ini", "mail", "CMC", "1")

IniWrite("C:\windows\win.ini", "mail", "CMCDLLNAME", "mapi.dll")

IniWrite("C:\windows\win.ini", "mail", "CMCDLLNAME32", "mapi32.dll")

IniWrite("C:\windows\win.ini", "mail", "MAPIX", "1")

IniWrite("C:\windows\win.ini", "mail", "MAPIXVER", "1.0.0.1")

IniWrite("C:\windows\win.ini", "mail", "OLEMessaging", "1")

d@ve

Share this post


Link to post
Share on other sites

You could also use variables, which would make it easier to make changes in the future. And you don't need the IniDelete

$WinIniName = @WindowsDir & "\win.ini"
$WinIniSection = "mail"

IniWrite($WinIniName, $WinIniSection, "MAPI", "1")
IniWrite($WinIniName, $WinIniSection, "CMC", "1")
IniWrite($WinIniName, $WinIniSection, "CMCDLLNAME", "mapi.dll")
IniWrite($WinIniName, $WinIniSection, "CMCDLLNAME32", "mapi32.dll")
IniWrite($WinIniName, $WinIniSection, "MAPIX", "1")
IniWrite($WinIniName, $WinIniSection, "MAPIXVER", "1.0.0.1")
IniWrite($WinIniName, $WinIniSection, "OLEMessaging", "1")

Share this post


Link to post
Share on other sites

thank you very much pete, that is very clean looking, thank you.

Share this post


Link to post
Share on other sites

is it possable within the script to check before the it runs if the user in an admin to the system?

d@ve

Share this post


Link to post
Share on other sites

You could also make sure that they have Admin by #RequireAdmin.

Share this post


Link to post
Share on other sites

something like this?

If Not IsAdmin() Then

MsgBox(48, "Error", "You Are Not An Admin")

exit

EndIf

d@ve

Share this post


Link to post
Share on other sites

i tested that, and it works great. thank you everyone for your help...

d@ve

Share this post


Link to post
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
Sign in to follow this  
Followers 0