Link to home
Start Free TrialLog in
Avatar of Richard Abogado
Richard AbogadoFlag for Venezuela, Bolivarian Republic of

asked on

How to change the wallpaper randomly to all users of the domain every day without being repeated?

Hello All,

I come to you because I need your help!

Currently I have a Batch and Script, which allows me to change the wallpaper automatically and randomly to all users of the domain, both work changing the images, however I have noticed that sometimes repeats a wallpaper without finishing the cliclo of xx images published in a folder.

Greetings and thanks from the atheist for your valuable help!

Richard
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Will have a look back tomorrow if others don't first.  Old question comment came from is here:

https://www.experts-exchange.com/questions/27448517/Copy-Random-File-to-Another-Direcotory-Batch-File.html?anchorAnswerId=42541608#a42541608

Steve
Avatar of Richard Abogado

ASKER

Ok I'll be waiting! Thank you!
please post your batch and your script.  Random doesn't mean that it will use all values with no repeats.  It is simply random..  i.e. you flip a coin 10 times you get 7 heads and 3 tails, you do it again you get 2 heads and 8 tails.  The odds do not change per coin flip, it is still 50/50.  If you flip a coin 8 times and get 8 heads, the odds on flipping a tail remain the same 50/50.  I've known people betting the farm that it will be tails since in their opinion it has to be tails (I enjoy taking their money :=)

computers are really bad at random number generation and without randomizing the seed of the random number generator you will get the same random results.  one method is to use the milliseconds since the computer was started.  There are many more escoritic methods of random number generation i.e. atmospheric noise.

i.e. 100  random numbers from 0-9
1512530346
7188285042
0364257402
1021827884
4182387281
8556678580
5431477780
1508773303
6448254541
2187707675
Imports System.Text

Module Module1


    Dim _random As Random = New Random()

    Function GetLetter() As Integer
        Dim number As Integer = _random.Next(0, 9)
        Return number
    End Function

    Sub Main()
        For j As Integer = 0 To 9
            Dim builder As New StringBuilder
            For i As Integer = 0 To 9
                Dim letter = GetLetter()
                builder.Append(letter.ToString())
            Next
            Dim s As String = builder.ToString()
            builder = Nothing
            Console.WriteLine(s)
        Next
        Console.ReadKey()
    End Sub
End Module

Open in new window

David, his batch is in link I posted before.
You can use a process similar to this and just replace the file in the source folder. If will then sync via GPO file preferences and replace on computers
https://www.experts-exchange.com/articles/29069/How-to-apply-a-dynamic-background-via-Active-Directory-GPP.html
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello! Excuse me, I was indisposed.

Thanks for replying!

David: You have many reasons in the probability!!

Shaun: It looks complex, I'll do some tests with the indicated procedure and I'll let you know how it went.

Steve: This one looks very practical, I try it and I warn you.

I want to thank both of you for your valuable time helping me.

Regards,

Richard
Ready!

I just tried the script sent by Steve and it works correctly, I think it was the most practical and uncomplicated.

Thank you very much everyone for your help, especially Steve for being attentive from the beginning of my question.

Greetings and I am also at your service,

Richard
No problem, glad it helped.

Steve