Powershell script

sophie.smithsophie.smith Registered Users Posts: 1 ■□□□□□□□□□
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.
[h=2][/h]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

Comments

  • PJ_SneakersPJ_Sneakers Member Posts: 884 ■■■■■■□□□□
    Is this like, your homework or something?
  • iBrokeITiBrokeIT Member Posts: 1,318 ■■■■■■■■■□
    What have you tried so far? ...Or did you just copy and paste your homework here hoping someone would just give you the answer?
    2019: GPEN | GCFE | GXPN | GICSP | CySA+ 
    2020: GCIP | GCIA 
    2021: GRID | GDSA | Pentest+ 
    2022: GMON | GDAT
    2023: GREM  | GSE | GCFA

    WGU BS IT-NA | SANS Grad Cert: PT&EH | SANS Grad Cert: ICS Security | SANS Grad Cert: Cyber Defense Ops SANS Grad Cert: Incident Response
  • LexluetharLexluethar Member Posts: 516
    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.
  • knownheroknownhero Member Posts: 450
    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 :thumbup:

    Road map 2017: JavaScript and modern web development

Sign In or Register to comment.