MS OneDrive, an online service for file storage and syncing across devices, is used by many to backup and store files. For enterprise backup and syncing, organizations rely on local or remotely...

MS OneDrive, an online service for file storage and syncing across devices, is used by many to backup and store files. For enterprise backup and syncing, organizations rely on local or remotely managed systems to secure their intellectual property. However, for simple backup of data PowerShell Automation can be used to trigger file transfers periodically. This assignment will exercise the use of PowerShell, designing a script that will copy files from one server to another, and setting it to run on a defined schedule.

PowerShell Setup


Check version of PowerShell usingGet-Hostor$PSVersionTable(should display 4.0)


Check the ability to run scripts usingGet-ExecutionPolicy(should be RemoteSigned). If not correct run command:Set-ExecutionPolicy -ExecutionPolicy RemoteSigned


Use the "Benchmark Security Automation with PowerShell" file and conduct online research to create a script to transfer files from one member server to another following these settings:


Member Server (source): create the folder C:\ITT430-Files


Transfer Server (destination): create the folder C:\ITT430-Storage… share this folder in your domain


Schedule the task to run every hour


Create an automated script that disables Active Directory users that have not logged on in 45 days.


Paste both working, full scripts into a single MS Word document and submit as directed.



                   Security Automation With PowerShell




Creating a PowerShell Script



In this exercise, you will create script by declaring parameters (like declaring variables in programming) and using the Copy-Item cmdlet



For

param

use: review https://technet.microsoft.com/en-us/library/jj554301.aspx


For

Copy-Item

use: review  https://technet.microsoft.com/en-us/library/ee156818.aspx



In Windows Server 2012, place the following contents into a text file (or use MS PowerShell IDE) to create and save the script as ITT430Copy.ps1 file. Save it and note the location.



param(


  [string]$computerName,


  [string]$filePath


)


Copy-Item -Path $computerName -Destination $filePath -Recurse





Creating a Scheduled Task to Automate the Script



In Windows Server 2012 R2, open MS PowerShell IDE


Perform the following commands:






Define the Scheduled Task


$Action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument “-NonInteractive -NoLogo -NoProfile -File C:\ ITT430Copy.ps1 -SourcePath C:\ITT430-Files* -DestinationPath \\ITT430-SV1\ITT430-Storage"




Set Schedule Trigger (time to execute)


$Trigger = New-ScheduledTaskTrigger -Once -At '12AM' -RepetitionInterval (New-TimeSpan -minutes 15) -RepetitionDuration (New-Timespan -hour 1000)




Place Scheduled Task and Trigger into memory


$Task = New-ScheduledTask -Action $Action -Trigger $Trigger -Settings (New-ScheduledTaskSettingsSet)




Register the Scheduled Task into System Scheduler


$Task | Register-ScheduledTask -TaskName 'File Transfer AutoSync' -User 'DomainAdmin' -Password 'password'


$Task




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here