i need help with this scripting assignment in power shell thanks
Summary :
Pasted below powershell script and output .
Note : Tested with sample
######################### PowerShell script #######################
# Read command line argument .
# if not found
$start_time = (GET-DATE)
if ($args.count -ne 1) {
Write-Host "Usage scrpt.ps1 <PATH> "
exit(0)
}
$path = $args[0]
# Check if input param is valid path
if (-Not (Test-Path $path)) {
Write-Host "Please check Input param as no entries
found under "
exit(0)
}
#
# Get all entries files in given folder
$files = Get-ChildItem -Path $path -ErrorAction Stop -recurse
$num_files = 0
$num_directories = 100000
$num_symlinks = 0
$num_files_older_than_365_days =0
$num_large_files = 0
$num_graphic_files = 0
$num_executable_files = 0
$num_temp_files = 0
$total_byte_count = 0
$slash = '\'
foreach ( $file in ($files ) ) {
$file_fullpath = $file.FullName
if ( ((Get-Item -Path $file_fullpath -ErrorAction Stop
) -is [System.IO.DirectoryInfo] )) {
$num_directories = $num_directories
+ 1
} else {
$num_files = $num_files + 1
if ( ($file_fullpath -Like "*.jpg")
-or ($file_fullpath -Like "*.gif") -or ($file_fullpath -Like
"*.bmp")) {
$num_graphic_files = $num_graphic_files +
1
}
if ( ($file_fullpath -Like "*.bat")
-or ($file_fullpath -Like "*.ps1") -or ($file_fullpath -Like
"*.exe")) {
$num_executable_files = $num_executable_files +
1
}
if ( ($file_fullpath -Like "*.o") )
{
$num_temp_files = $num_temp_files + 1
}
}
if ((Get-Item -Path $file_fullpath ).LinkType -eq
"SymbolicLink" ) {
$num_symlinks =
$num_symlinks + 1
}
$len = (Get-Item -Path $file_fullpath ).length
if ( $len -gt 500000 ) {
$num_large_files = $num_large_files
+ 1
}
$file_created_date = (Get-Item -Path
$file_fullpath).CreationTime
if ( ($start_time - $file_created_date).Days -gt 365 )
{
$num_files_older_than_365_days =
$num_files_older_than_365_days + 1
}
$total_byte_count = $total_byte_count + $len
}
$end_time = (GET-DATE)
$exection_time = ($end_time - $start_time )
$todate = (Get-DATE -DisplayHint date)
Write-Host "Search Report " $env:computername $path
$todate.ToString("yyyy-MM-dd")
Write-Host "Execution time " $exection_time.ToString("ss")
Write-Host "Directories " $num_directories.ToString('N0')
Write-Host "Files "
$num_files.ToString('N0')
Write-Host "Sym Links " $num_symlinks.ToString('N0')
Write-Host "Old files "
$num_files_older_than_365_days.ToString('N0')
Write-Host "Large files " $num_large_files.ToString('N0')
Write-Host "Graphic files " $num_graphic_files.ToString('N0')
Write-Host "Executable files "
$num_executable_files.ToString('N0')
Write-Host "Temporary files " $num_temp_files.ToString('N0')
Write-Host "TotalFileSize " $total_byte_count.ToString('N0')
#######################End of PowerShell Script ####################
##################### Output ########################################
####################### End of Output #####################################
i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and...
Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a shell file called by (your name), your enrollment number, your program and the courses you study. Use the appropriate variables and display the above to the standard output (screen). . 2. Write A Shell Script to perform the following: Display the files and directories Print the date in 24 hour format Display the System id Display the current working directory Print the status of...
need help with this assignment, please. Part 1 - Java program named MemoryCalculator In your Ubuntu VM (virtual machine), using terminal mode ONLY, do the following: Create the folder program2 In this folder place the text file located on my faculty website in Module 2 called RAMerrors (Do not rename this file, it has no extension.) It is down below. Ths is the file RAMErrors 3CDAEFFAD ABCDEFABC 7A0EDF301 1A00D0000 Each record in this file represents the location of an error...
i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...
NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...
I need this in C++. This is all one question. Introduction Your eighth assignment will consist of two programs, which will involve the use of simple classes. The source code for these problems should be submitted using the naming conventions we specified in class. Please note that your computer programs should comply with the commenting and formatting rules as described in class. For example, there should be a header for the whole program that gives the author's name, class name,...