Seite 1 von 1

Manage Windows accounts and desktop background

Verfasst: 14 Mär 2014, 11:52
von student14
Hi everyone,

I add a new local user using opsi conf manager, but I'm trying now to delete it with the scrypt and I could not find the problem. I hope anyone will help me. Here is the code that I used:

Code: Alles auswählen

[Actions]
DefVar $username$
DefVar $fullname$
DefVar $password$
DefVar $isAdmin$
DefVar $syslanguage$

Set $username$ = GetProductProperty("user_name", "Test")
Set $fullname$ = GetProductProperty("user_fullname", "Test")
Set $password$ = GetProductProperty("password", "test")
Set $isAdmin$ = GetProductProperty("is_admin", "true")
Set $syslanguage$ = GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language] Default")

Message "Adding user to local machine"

winbatch_deluser

[winbatch_deluser]
if ($isAdmin$ = "true")

   net user $username$ $password$ /del /passwordreq:yes /fullname:"$fullname$"
   
   if ($syslanguage$ = "0816")
      net localgroup Administradores $username$ /del
   else
      net localgroup Administrators $username$ /del
   endif
   
else

   net user $username$ $password$ /del /passwordreq:yes /fullname:"$fullname$"


I also want to change my desktop background. I tryied with this scrypt:

Code: Alles auswählen

[Actions]
DefVar $Value$
DefVar $isAdmin$
DefVar $Path$


Set $username$ = GetProductProperty("user_name", "Test")
Set $Value$= GetProductProperty("background.jpg")
Set $isAdmin$ = GetProductProperty("is_admin", "true")
Set $Path$=Set-ItemProperty('HKCU:\Control Panel\Desktop\')
Please someone help me!

Re: Manage Windows accounts and desktop background

Verfasst: 14 Mär 2014, 14:41
von dkoch
Hey there.
@1. Script:
Please always provide the logs along with your Scripts but let me guess

Code: Alles auswählen

net user $username$ $password$ /del /passwordreq:yes /fullname:"$fullname$"
I dont thing /del works fine with $password$, /passwordreq and /fullname. Just remove them. They are not need when deleting

@2. Script:
You missed to paste something i guess. There are only some definitons.