none
Powershell Automate Script & Windows Service RRS feed

  • Question

  • I have a script that I would like to run at a specific time every evening on the most recently downloaded .txt file and edit the data contained before sending the appended file automatically. 

    It is my understanding that in order to achieve this; I am to make a .ps1 with all of the manipulations that I would like to perform. After this is finished, I create a service to call the aforementioned .ps1 from the command prompt;

    Where I am foggy is in regards to the creation of a service; Is the service that I create to run my 'logic.ps1' file created in the Powershell ISE and saved in the same directory as the script I would like to apply the service to, is it possible to save a 'sc.exe create'? Or do I run an 'sc.exe create' on the system that I intend my script to run on?  

    Or am I better off just making a 'logic.ps1' file and utilizing Windows Service Manager on the system I want the script to automatically run from?

    I hope this isn't a garbage question; I am new to automated scripting and am unclear of which direction is the best direction when it comes to Powershell Script Automation.

    Again, thank you so much for your time and patience.

    Tuesday, October 3, 2017 11:47 PM

Answers

All replies

  • Please fix your post.  It is full of HTML formatting commands.

    Try to understand that technical forums are not intended to fix your code for you. That is beyond the scope of this forum. 

    Tech forums are not customer service or tech support.  You must ask a question and not just post a shopping list.  As a clear question about one thing that you are having problems with or that is causing an error.


    \_(ツ)_/

    Wednesday, October 4, 2017 12:27 AM
    Moderator
  • Very fair; please forgive the formatting and thirst. I tried to make it not poopy but clearly failed miserably. I appreciate you taking the time to give it a once over and respond. I'll be sure to improve my posts in the future and refrain from fouling the forum space. 

    :)

    Wednesday, October 4, 2017 12:30 AM
  • Very fair; please forgive the formatting and thirst. I tried to make it not poopy but clearly failed miserably. I appreciate you taking the time to give it a once over and respond. I'll be sure to improve my posts in the future and refrain from fouling the forum space. 

    :)

    You are not fowling anything. You just need to learn the forum rules and also learn enough PowerShell to be able to ask good questions. You are only ding what most desktop techs or admins do who have no programming or development experience. You are about to enter a new and exciting world. Take the time to learn PowerShell.

    The HTML issue is due to the browser you are using. (Chrome and older Fox browsers do that).  Use IE or Edge to post and the issue will go away.

    Now go back and  clarify the question. We can still give a try to either answer or point you in the right direction.  Don't just give up.


    \_(ツ)_/


    • Edited by jrvModerator Wednesday, October 4, 2017 12:39 AM
    Wednesday, October 4, 2017 12:38 AM
    Moderator
  • Really appreciate you being so helpful and encouraging; currently working on a more appropriate question. I won't just give up :) 

    :)

    Wednesday, October 4, 2017 12:45 AM
  • Just ask the first question about the first issue you are having.

    \_(ツ)_/

    Wednesday, October 4, 2017 12:46 AM
    Moderator
  • We wouldn't use a service to run a script.  We would use a Scheduled Task.

    I would recommend starting with learning PowerShell.

    Learn PowerShell: https://mva.microsoft.com/en-us/training-courses/getting-started-with-microsoft-powershell-8276

    Also find scripts here: http://gallery.technet.microsoft.com<o:p></o:p>




    \_(ツ)_/

    Wednesday, October 4, 2017 1:29 AM
    Moderator
  • Thank you so much, I am so appreciative for the time and patience you have dedicated on my behalf. I was overwhelmed and I let it get the best of me. Thank you for giving me a starting off point and something to center my focus on. A seed to sow. 
    I hope to be more beneficial to this community going forward.

    :)

    Wednesday, October 4, 2017 1:35 AM
  • The best place is that video then buy one of the many good books on PowerShell.  The current and, in my opinion, best, is PowerShell in Action Third Edition.  It was just published two week ago.  It was written by Bruce Payette, one of the designers of PS and Richard Siddaway.   It is excellent and is good as training and as a reference.  It is loaded with great info, some of which is not documented or often ignored.


    \_(ツ)_/

    Wednesday, October 4, 2017 1:51 AM
    Moderator