Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Converting Batch script to powershell  (Read 5155 times)

0 Members and 1 Guest are viewing this topic.

Arotin

    Topic Starter


    Rookie

    • Experience: Beginner
    • OS: Windows 7
    Converting Batch script to powershell
    « on: September 29, 2017, 05:44:28 PM »
    Hi Guys,

    I am not sure if i can post this here so please let me know; I want to try and convert this batch script into a powershell one, anyone here with experience in ISE? I am not experienced with it but i am trying to learn...

    If you have questions of what the script does please let me know,

    Thank you



    Code: [Select]
    for /f %%F in (IP.txt) do (

    psexec.exe \\%%F -u administrator -p PassWord msg.exe * /time:30  UPDATE - App will close in 30 seconds for new updates to be installed. Please stand by
    timeout 30

    psexec.exe \\%%F -u administrator -p PassWord  msg.exe * /time:58 now updating - Please DO NOT use the computer.
    timeout 3

    pskill.exe "AppProcess" \\%%F -u administrator -p PassWord
    timeout 5

    psexec.exe -u administrator -p PassWord  \\%%F xcopy "\\%MYIP%\Share\folder1" "\\%%F\C$\Program Files (x86)\folder1" /E /C /H /R /K /Y
    timeout 5

    psexec.exe \\%%F -u administrator -p PassWord  msg.exe * updated! If you experience any issues please call . Thank you
    )


    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Converting Batch script to powershell
    « Reply #1 on: September 30, 2017, 06:59:42 AM »
    Why is the batch file a problem? Whats the goal in having it all in powershell without the batch mechanism that calls to powershell?

    Is this batch your exact batch or something copy/pasted from elsewhere as an example?

    I look at this and see no problems with its use other than that the user/password is out in the open wherever this batch resides, but if on 1 computer under your control then not a problem as powershell within the batch passes authentication over network to remote systems as listed in your IP.TXT list.

    Arotin

      Topic Starter


      Rookie

      • Experience: Beginner
      • OS: Windows 7
      Re: Converting Batch script to powershell
      « Reply #2 on: October 03, 2017, 11:48:07 AM »
      OBVIOUSLY those are not the real passwords......
      I need to convert this to Powershell for a reason that is not your concern (:
      If you cant do it then please move along.


      Thanks

      DaveLembke



        Sage
      • Thanked: 662
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Converting Batch script to powershell
      « Reply #3 on: October 03, 2017, 12:05:13 PM »
      WOW NASTY .... Well obviously you have plans to do something illegal or malicious then cause nice people generally dont ask for illegal advice with attitude. Move along little one.  ;D

      Hiding the reason = your up to no good  :P

      Arotin

        Topic Starter


        Rookie

        • Experience: Beginner
        • OS: Windows 7
        Re: Converting Batch script to powershell
        « Reply #4 on: October 03, 2017, 02:27:49 PM »
        lol how is that illegal , all the script is doing is copying stuff between computers in one network.

        I have replaced all the info thats sensitive info and you are commenting some ignorant *censored*. If you are not here to help then why are you even wasting your time commenting?? are you that much of a salty person? By the way if you are going to accuse someone of doing something illegal then have some proof.  edited by Allan
        « Last Edit: October 03, 2017, 03:30:58 PM by Allan »

        Allan

        • Moderator

        • Mastermind
        • Thanked: 1260
        • Experience: Guru
        • OS: Windows 10
        Re: Converting Batch script to powershell
        « Reply #5 on: October 03, 2017, 03:29:12 PM »
        I've edited your post. No more personal attacks please.

        Arotin

          Topic Starter


          Rookie

          • Experience: Beginner
          • OS: Windows 7
          Re: Converting Batch script to powershell
          « Reply #6 on: October 03, 2017, 03:58:49 PM »
          Then make sure people don't come and post stuff like that. i'm asking for help if you don't want to then move along. no need to comment.

          Allan

          • Moderator

          • Mastermind
          • Thanked: 1260
          • Experience: Guru
          • OS: Windows 10
          Re: Converting Batch script to powershell
          « Reply #7 on: October 03, 2017, 07:45:51 PM »
          okay, thanks for stopping by. Lot's of other sites will no doubt welcome you.