+ Reply to Thread
Results 1 to 5 of 5
  1. Junior Member Registered Member
    Join Date
    Oct 2016
    Posts
    1
    #1

    Question Powershell script

    Hi i am new to powershell, trying to learn it can anyone help me in doing the question below?
    i am again repeating i am just a beginner in powershell, trying to learn
    Occasionally the operators have been selecting the incorrect tapes for the nightly backups. This has resulted in the wrong tapes being written to, and the loss of valuable backups.

    There is a proposal to implement a fully featured commercial backup system, but that is still some months away from being approved and implemented.

    Write a script which shall help the operators choose the correct tape to use for the nightly backup.
    There information about our backup tapes is stored in file “Tape_Catalog.csv”.
    The script should list the VolID of tapes that are suitable for the operator to use:
    1. Their expiry date is less than todays date.
    2. They are onsite.
    The operator is to be prompted to select a VolID.
    The data for the selected VolID will be updated as follows:
    1. The BackupName will be set to “Nightly Backup”
    2. The BackupDate will be set to today’s date
    3. The Expiration will be set to 8 days from now
    4. The number of uses will be incremented by one
    The updated information for the selected VolID will be displayed to the screen.
    The updated information will be saved back to the original file (“Tape_Catalog.csv”).


    catalog.csv file
    VolID Location CapacityTB Birthdate Uses Condition BackupName BackupDate BackupExpiration
    CB00102 HeadOffice 8 29-Jun-12 42 GOOD Nightly Backup 2-May-15 9-May-15
    CB00103 HeadOffice 8 29-Jun-12 24 GOOD Nightly Backup 3-May-15 ########
    CB00104 HeadOffice 8 29-Jun-12 34 GOOD Nightly Backup 4-May-15 ########
    CB00108 OffsiteSecureStorage 8 29-Jun-12 23 GOOD Nightly Backup 8-May-15 ########
    CB00109 OffsiteSecureStorage 8 29-Jun-12 43 GOOD Nightly Backup 9-May-15 ########
    CB00112 HeadOffice 8 2-Nov-08 3 POOR Backup Pre Upgrade ######## ########
    CB00113 HeadOffice 8 2-Nov-08 2 POOR Backup Pre Upgrade ######## ########
    CB00114 HeadOffice 8 29-Jun-12 43 GOOD Nightly Backup ######## 7-May-15
    CB00115 HeadOffice 8 29-Jun-12 23 GOOD Nightly Backup 1-May-15 8-May-15
    CB00116 HeadOffice 8 ######## 52 GOOD Monthly Backup ######## ########
    CB00117 HeadOffice 8 ######## 43 GOOD Monthly Backup ######## ########
    CB00118 HeadOffice 8 ######## 34 GOOD Monthly Backup ######## ########
    CB00105 HeadOffice 8 29-Jun-12 43 GOOD Nightly Backup 5-May-15 ########
    CB00119 HeadOffice 8 ######## 54 GOOD Monthly Backup 28-Jan-15 28-Jan-16
    CB00120 HeadOffice 8 29-Jun-12 23 GOOD Nightly Backup 6-May-15 ########
    CB00121 OffsiteSecureStorage 8 29-Jun-12 43 GOOD Nightly Backup 7-May-15 ########
    CB00122 HeadOffice 8 ######## 54 GOOD Monthly Backup 28-Oct-14 28-Oct-15
    CB00123 HeadOffice 8 ######## 34 GOOD Monthly Backup ######## ########
    CB00124 HeadOffice 8 ######## 23 GOOD Monthly Backup ######## ########
    CB00125 HeadOffice 8 ######## 23 GOOD Monthly Backup 28-Jul-14 28-Jul-15
    CB00126 BCPSite 8 ######## 49 GOOD Annual Backup 1-Jul-14 1-Jul-21
    CB00127 OffsiteSecureStorage 8 2-Nov-08 55 POOR Annual Backup 2-Jul-13 2-Jul-20
    CB00128 HeadOffice 8 2-Nov-08 44 POOR Annual Backup 1-Jul-12 1-Jul-19
    CB00129 HeadOffice 8 2-Nov-08 33 POOR Annual Backup 3-Jul-11 3-Jul-18
    CB00130 HeadOffice 8 2-Nov-08 5 POOR Annual Backup 4-Jul-09 4-Jul-16
    CB00131 HeadOffice 8 2-Nov-08 3 POOR Backup Pre Upgrade ######## ########
    CB00132 BCPSite 8 ######## 12 GOOD Monthly Backup ######## ########
    CB00133 HeadOffice 8 ######## 34 GOOD Monthly Backup ######## ########
    CB00134 HeadOffice 8 ######## 43 GOOD Monthly Backup ######## ########
    CB00135 OffsiteSecureStorage 8 29-Jun-12 43 GOOD Nightly Backup ######## ########
    CB00136 BCPSite 8 29-Jun-12 54 GOOD Nightly Backup ######## ########
    CB00137 HeadOffice 8 2-Nov-08 25 POOR Annual Backup 1-Jul-10 1-Jul-17
    Reply With Quote Quote  

  2. SS -->
  3. The ceiling is glass. PJ_Sneakers's Avatar
    Join Date
    Nov 2014
    Location
    169.254.0.1
    Posts
    770

    Certifications
    AccessData, Cellebrite, CompTIA, EC-Council, IACRB, (ISC)˛, Microsoft, MSAB
    #2
    Is this like, your homework or something?
    Reply With Quote Quote  

  4. Reticulating splines... iBrokeIT's Avatar
    Join Date
    Jul 2013
    Location
    Twin Cities, MN
    Posts
    1,045

    Certifications
    GCIH, GSEC, VCAP5-DCA, VCP5-DCV, MCITP:EA, MCSA 2003/08
    #3
    What have you tried so far? ...Or did you just copy and paste your homework here hoping someone would just give you the answer?
    Reply With Quote Quote  

  5. Senior Member
    Join Date
    Mar 2013
    Location
    Midwest
    Posts
    512

    Certifications
    MCSA Server 2008, VCP 5 DCV, CompTIA A+, Net+, 70-640, 70-642, 70-620, 70-646
    #4
    Looks like homework....

    Break the code into more manageable chunks. First define your variables and load them from the spreadsheet, second create a function to compare those variables. Third create the execution line to write what is needed.
    Reply With Quote Quote  

  6. Senior Member knownhero's Avatar
    Join Date
    Jul 2008
    Location
    UK
    Posts
    435

    Certifications
    MCSE: SharePoint 2013, Productivity
    #5
    Why the heck would you want PowerShell to do this?

    You'll be best making this in Excel with formula's etc. PowerShell will be an extra unwanted step in getting the same results.
    70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
    MCSE - SharePoint 2013

    Road map 2017: JavaScript and modern web development

    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks