Textdatei für alle Nutzer einzeln ändern

Antworten
andré
Beiträge: 329
Registriert: 07 Jan 2014, 10:48

Textdatei für alle Nutzer einzeln ändern

Beitrag von andré »

Hi,

ich habe hier ein Softwarephone, bei dem ich die Konfiguration für alle Nutzer einzeln ändern möchte. Unter dem Programmverzeichnis bei c:\Program Files liegt die Konfigurationsdatei, die dann einfach ins Benutzerverzeichnis unter Roaming abgelegt wird. Mein Problem ist, dass der Benutzername des jeweiligen Nutzers mit in diese Konfigurationsdatei rein muss. Irgendeine Idee, wie man das umsetzen könnte, ohne ein Skript in den Autostart zu legen?

Laut Handbuch kann ich den Parameter AllNtUserProfiles nutzen, um Dateien in die Userprofile zu schieben. Fehlen würde das nur noch der Benutzername, der direkt in die Datei rein geschrieben werden müsste. Da gäbe es noch die Frage, ob AllNtUserProfiles die Konfigurationsdatei in Default ablegt, sodass neue angemeldete Nutzer diese Konfigurationsdatei auch bekommen?

grüße
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Textdatei für alle Nutzer einzeln ändern

Beitrag von SisterOfMercy »

Have you tried if the config file works with %USERNAME%?
If not you can always patch the config file after copying or write the entire config file from opsi. It's also written to the default user.

A snippet from a script, which users getProfilesDirList:

Code: Alles auswählen

DefStringList $profileslist$
Set $profileslist$ = getProfilesDirList
for $value$ in $profileslist$ do sub_install_cert_existing_profiles_thunderbird

[sub_install_cert_existing_profiles_thunderbird]
Set $profiles_ini$ = "$value$" + "\Application Data\Thunderbird\profiles.ini"
if FileExists($profiles_ini$)
	Set $prefs_path$ = GetValueFromInifile($profiles_ini$,"Profile0","Path","")
	Set $prefs_IsRelative$ = GetValueFromInifile($profiles_ini$,"Profile0","IsRelative","")
	if ($prefs_IsRelative$ = "1")
		comment "Path to profile is relative"
		Set $prefs_path$ = "$value$" + "\Application Data\Thunderbird\" + $prefs_path$
	else
		comment "Path to profile is absolute"
	endif
	
	if ((NOT (FileExists($prefs_path$+"\key3.db"))) OR (NOT (FileExists($prefs_path$+"\cert8.db")))) OR (NOT (FileExists($prefs_path$+"\secmod.db")))
		DosInAnIcon_createdb_existing_mozilla_profiles
	endif
	DosInAnIcon_certutil_existing_mozilla_profiles
endif
But this would of course only work for the existing users. A new user would get the file that's in the default profile, with the wrong username. If the config file can use environment variables it would be a lot easier.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
dkoch
Beiträge: 309
Registriert: 25 Nov 2011, 14:03

Re: Textdatei für alle Nutzer einzeln ändern

Beitrag von dkoch »

Entweder Autostart oder mit User Profile Management

https://download.uib.de/opsi_stable/doc/winstdoc-de.pdf siehe 8.9
andré
Beiträge: 329
Registriert: 07 Jan 2014, 10:48

Re: Textdatei für alle Nutzer einzeln ändern

Beitrag von andré »

Hm, hatte nicht so funktioniert, wie gedacht. Ich habe den Versuch aber auch wieder abgebrochen. Ich hatte vergessen, dass es hier auch Rechner ohne Opsi gibt, die diese Konfig bekommen sollen. Daher wurde das jetzt doch über eine Batch-Datei im Autostart gelöst. Trotzdem danke dir.
Antworten