Script that displays computer name backwards

Hi All,

I am new on Powershell and I have been give this task and I am struggling with it please help.

Create a script that obtains the machine name. The script should then write out the machine name
backwards and store it in task3.txt in the user’s temporary directory (C:\Temp or tmp). You must use a loop
to achieve this.

Luzuko,
Welcome to the forum. :wave:t4:

If this is a homework assignment or something similar you should approach your teacher or tutor if you have problems with the task.

Regardless of that - as this is actually a fairly easy and basic task - what are you struggling with exactly?

You may start with reading the help following help topics:

I am struggling with creating a loop that will display the computer name backwards and it is not a homework from school but I am learning how to script now

The second link I posted in my answer actually has the answer. :wink:

Consider the name of the computer as an array of characters. If you know the length of the array you can set up a loop decreasing the index of the characters iterating over all single characters starting with the last (highest index). :wink:

Thank you I managed to create the script

Great. I’m proud of you. :+1:t4: :slightly_smiling_face:

Would you like to share your solution here? It might help others looking for the same or something similar. :wink: