n/a RRS feed

  • Question

  • n/a n/a

    • Edited by idontknow1900 Monday, July 22, 2019 2:03 PM
    • Moved by jrv Monday, July 22, 2019 9:21 PM abandoned
    Monday, July 22, 2019 5:31 AM

All replies

  • Sorry but this is not a free script debugging forum. We cannot go through 600+ lines of code and find your errors. Post a simple example of the part of the code that is failing

    We cannot design a solution. You will need to use SMO to find all backup devices on your server and display that.  If backups are done without a registered backup device then you will need to know where the backups are located which can be almost anywhere in your network.


    • Edited by jrv Monday, July 22, 2019 6:19 AM
    Monday, July 22, 2019 6:13 AM
  • A quick look at your code says that you have written about 500 lines more than needed to accomplish the task. It is written like an old DOS batch file and takes no advantage of PowerShell's advanced programming support. If you were to take some time and study jow to write a PowerShell script and how to design a program and its user interface you would find that most of your code is unnecessary.

    I understand the work you put into this.  I am sure you learned a lot writing it and now actually studying PowerShell will be easier as you will easily see how PS helps you to avoid too much code and writing spaghetti code. 

    I would also suggest that using Windows Forms would make any tools that have a complex UI much easer to write and maintain.

    Here is an older but still valid example of using WinForms with SQLServer and PowerShell.  It is not "tool" targeted but it does show how esy it is to do complicated things easily with PS and Forms.  It is a good sampler of how to use many of the controls and how to easily get PowerShell to gather data and perform useful work.



    • Edited by jrv Monday, July 22, 2019 6:27 AM
    Monday, July 22, 2019 6:26 AM
  • The following link will help you understand how to ask questions in this forum:

    How to ask questions in a technical forum

    Also a large amount of what you are trying to code can be done more easily with SMO.  I also recommend avoiding Json until you need to send Json.  I can't tell from your code because the code is unusable as posted.  Too many things are not defined.  I suspect they may be in your profile and not in the script.

    I highly recommend against overuse of classes in PowerShell.  They are useful for some things and useful in DSC but can make code much harder to manage.

    From the code I would guess you are likely a web builder and not a systems programmer.  Just a guess.


    Monday, July 22, 2019 6:37 AM