[Actions] requiredWinstVersion >= "4.11.2.1" setLogLevel=3 DefVar $ProductId$ DefVar $ProductName$ DefVar $local_user$ DefVar $local_desc$ DefVar $Group$ DefVar $SearchResult$ DefVar $flag_active$ DefVar $val_userpasswd$ DefVar $val_username$ DefVar $val_userdesc$ DefVar $val_groupmember$ DefVar $val_expires$ DefVar $UserExists$ DefVar $UserGroup$ DefVar $date_tomorrow$ DefStringlist $ResultList$ DefStringlist $ResultList2$ DefStringlist $ResultList3$ ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: ; from builder-product.cfg : all variables definded by attribute WINST[index] ; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE ; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL ; auto generated winst-variables ; $IconFile$: path to product picture ; @@BUILDER_VARIABLES@@ sub_get_properties comment "get the name of the admin group" comment "using psgetsid from sysinernals pstools" if $UserGroup$ = "Administratoren" set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_admin_group") endif if $UserGroup$ = "Benutzer" set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_user_group") endif if $UserGroup$ = "Gaeste" set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_guest_group") endif set $Group$ = takeString(6,$ResultList$) set $Group$ = takeString(1,splitstring($Group$,"\")) comment "Check if user exists." comment "If user exists, the password will be altered. Otherwise, the user will be created." set $ResultList2$ = getOutStreamFromSection("DosInAnIcon_checkuser") set $UserExists$ = takeString(0,$ResultList2$) setLogLevel=0 comment "create our local user" if $UserExists$ = "no" DosInAnIcon_makeadmin else DosInAnIcon_alter_pw endif setLogLevel=3 comment "Enables or disables the user." comment "flag_active is set to 'no' by the product properties for not opening accidently a security risk *g*." if $flag_active$ = "on" DosInAnIcon_enable_admin else DosInAnIcon_disable_admin endif set $ResultList3$ = getOutStreamFromSection("DosInAnIcon_get_date_tomorrow") set $date_tomorrow$ = takeString(2,$ResultList3$) ;set $date_tomorrow$ = takeString(1,splitstring(" ",$date_tomorrow$)) if $val_expires$ = "never" DosInAnIcon_expires_never else DosInAnIcon_expires_tomorrow endif [sub_get_properties] comment "flag_active" comment "description: User active" Set $flag_active$ = GetProductProperty("flag_active", "off") comment "val_userpasswd" comment "description: password" Set $val_userpasswd$ = GetProductProperty("val_userpasswd", "SecurePW!") comment "val_username" comment "description: admin username" set $local_user$= GetProductProperty("val_username", "locsupp") comment "val_userdesc" comment "description: admin user description" set $local_desc$= GetProductProperty("val_userdesc", "Local Support") comment "val_groupmember" comment "description: Groupemembership" set $UserGroup$= GetProductProperty("val_groupmember", "Administratoren") comment "val_expires" comment "description: expires" set $val_expires$ = GetProductProperty("val_expires", "tomorrow") [DosInAnIcon_checkuser] @echo off net user $local_user$ >nul 2>&1 && echo yes || echo no [DosInAnIcon_get_admin_group] @echo off "$PsGetSidExe$" /accepteula S-1-5-32-544 [DosInAnIcon_get_user_group] @echo off "$PsGetSidExe$" /accepteula S-1-5-32-545 [DosInAnIcon_get_guest_group] @echo off "$PsGetSidExe$" /accepteula S-1-5-32-547 [DosInAnIcon_makeadmin] NET USER $local_user$ $val_userpasswd$ /ADD /comment:"Local User created by opsi-package" /fullname:"$local_desc$" /passwordchg:no /passwordreq:yes NET LOCALGROUP $Group$ /ADD $local_user$ [DosInAnIcon_alter_pw] NET USER $local_user$ $val_userpasswd$ [DosInAnIcon_enable_admin] NET USER $local_user$ /active:yes [DosInAnIcon_disable_admin] NET USER $local_user$ /active:no [DosInAnIcon_get_date_tomorrow] %ScriptPath%\morgen.bat [DosInAnIcon_expires_never] NET USER $local_user$ /expires:never [DosInAnIcon_expires_tomorrow] NET USER $local_user$ /expires:$date_tomorrow$