Coder Social home page Coder Social logo

itps.omcs.tools's Introduction

ITPS.OMCS.Tools

IT PowerShell Open Minded Common Sense Tools

(No connection to the MIT OMCS project)

This is the second third go around of some tools. The original idea was to create a series of tools that could be used by the desk side support tech. I found that some of the tasks that were being completed didn't need to have elevated rights, so I recreated this toolset to be run as the logged on users. Now, months later and a better understanding of modules, Github and life overall, I have done some updates to the overall module and some changes to the code. This also marks the beginning of work with Linux, so although not all of the modules will work with Linux, care is going into that OS.

Original Toolset:

  • Add-NetworkPrinter - Unchanged You need to know the Print Server Name. It will provide a list of printers that you are allowed to print to.

  • Compare-Folders - Minor Changes This version allows you to identify a parent folder before select the two to compare.

  • Get-InstalledSoftware - Unchanged This returns the version of the software named.

  • New-TimedStampFileName - Removed One of my original funtions that I used in early scripting. It just spits out a file name with a time stamp. It really didn't grow, so it has been removed from this module, and rewritten as New-TimeStampFile which actually creates the file. And moved to the ITPS.OMCS.CodingFunction module.

  • Repair-FolderRedirection - Major Changes This has been changed from a single script which did both report and fix to two. See below: Get-FolderRedirection and Set-FolderRedirection.

  • Test-AdWorkstationConnections - Unchanged Collects a list of computers from AD base the the Searchbase you provide and returns two files, first is the full list of computers the next is a list of computer that not responded to the "ping". Because it uses the Net bios name to ping, this also tests the DNS servers. It also gives a list of all of the computers that are in the searchbase.

  • Test-FiberSatellite - Unchanged "Pings" servers based on your input and gives an does the math and gives an average. This was setup, where it was important to know if we were working over the fiber (~60ms average) or over the satellite (+600ms average). By default it pings the big search engine websites. Output example: 8/2/2021 14:09:13 - username tested 5 remote sites and 5 responded. The average response time: 33ms The Ping-O-Matic Fiber Tester! Round Trip Time is GOOD!

  • Test-PrinterStatus - Similar to Test-AdWorkstationConnections, but for printers. You have to provide the printserver name.

  • Test-Replication - This is a manual "brut force" test of DFSR. It writes to a file on one node and reads it on its replication partner, then does the same thing in reverse. You must know at least two of the replication partners.

New Tools:

  • Get-SystemUpTime - This was build after users lieing or not understanding what a Reboot is.
    It will give you the following: ComputerName, LastBoot, TotalHours
  • Get-FolderRedirection - NEW Returns the location of the user's files. This is a way to make sure there is nothing wrong with the folder redirection and they are saving to the HD.
  • Set-FolderRedirection - NEW Changes the location of the user's files and copies them if needed. This will make the changes in the HKCU registry to fix folder redirection.
Import-Module -Name ITPS.OMCS.Tools -Scope Local    # When using this as a normal user.

Module Downloads:

Version 1.8.1 has been uploaded to the PowerShell Gallery

This current version 1.12.2.8 is only available at Github under the Module Testing branch.

itps.omcs.tools's People

Contributors

ogjakfy8 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

itps.omcs.tools's Issues

'f_$OutputTable.Report' is not recognized

Describe the bug
The term 'f_$OutputTable.Report' is not recognized as the name of a cmdlet, function, script file, or operable program.

To Reproduce
Steps to reproduce the behavior:

  1. Run: Test-FiberSatellite
    8/2/2021 14:09:13 - erika tested 5 remote sites and 5 responded. The average response time: 33ms

The Ping-O-Matic Fiber Tester!
Round Trip Time is GOOD!
f_$OutputTable.Report : The term 'f_$OutputTable.Report' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At C:\Users\erika\Documents\WindowsPowerShell\Modules\ITPS.OMCS.Tools\1.11.1.7\Modules\Connectio
nsModule.psm1:416 char:9

  • '@ -f $(f_$OutputTable.Report), ('-' * 31), ('You can find the full r ...
  •     ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (f_$OutputTable.Report:String) [], CommandNotFoun
      dException
    • FullyQualifiedErrorId : CommandNotFoundException

Expected behavior
No message

Get-InstalledSoftware - Update comment help

Is your feature request related to a problem? Please describe.

Get-Help Get-InstalledSoftware

It is not robust enough.
It doesn't have examples or a full description.

Describe the solution you'd like
Update the Comment Help

Ping the devices to ensure they are connected

Is your feature request related to a problem? Please describe.
After switching from Dell (Lexmark) to HP the "Status" doesn't change. Since the rest of the tests are "ping" tests make this one too.

Describe the solution you'd like
Find the port that is assigned to the printer (the actual print device) and ping it.

Describe alternatives you've considered
None

Additional context
None at this time.

Requires Admin now

Describe the bug
Repair-WindowsUpdate sends all sorts of errors to the console, if you are not an admin.

To Reproduce
Steps to reproduce the behavior:

  1. Run Repair-WindowsUpdate as a normal user.

Expected behavior
Should give a "pretty" error message to warn the user they need admin rights

Additional context
Add any other context about the problem here.

Compare-Folders did not work on a 2008 server.

Was attempting to use this yesterday on a 2008 server and it kept kicking out an error.

Since, I was able to access the same files through a share, I completed it there, and since the 2008 server is going away, I am not going to worry about this too much. I just want it documented.

Change the Test-FiberSatellite report to a CSV for later trending

Is your feature request related to a problem? Please describe.
Not really

Describe the solution you'd like
Make a CSV output file that can be used for trending.

Describe alternatives you've considered
Manipulating the log file with Python to get trending.

Additional context
Requesting for a friend

Here is the code for the CSV.

It just needs to be inserted into the original script

Same Parameters (mostly)

Added PingStat hashtable and ColumnNames for comparing the current file header, with what is in Sites.

$TimeStamp = Get-Date -Format G 
$Sites = @('localhost', 'www.google.com', 'www.bing.com', 'www.cnn.com', 'www.yahoo.com', 'random', '192.168.1.3')
$PingStat = [Ordered]@{
  'DateStamp' = $TimeStamp
}
$columns = @()
$PingReport = 'C:\temp\Reports\Ping.csv'
$PingReportInput = Import-Csv $PingReport
$ColumnNames = ($PingReportInput[0].psobject.Properties).name

Add any new sites to the report file

foreach($site in $Sites)
{
  Write-Verbose -Message "1. $site"
  if(! $ColumnNames.contains($site))
  {
    Write-Verbose -Message "2. $site"
    $PingReportInput | Add-Member -MemberType NoteProperty -Name $site -Value $null -Force
    $PingReportInput  | Export-Csv $PingReport -NoTypeInformation
  }
}

Ping the Sites

This is done as a job in this one. This script will run on it's own.

$job = Test-Connection -ComputerName $Sites -AsJob -Count 1 #-BufferSize 1024
if ($job.JobStateInfo.State -ne 'Running') 
{
  $Results = Receive-Job $job
}

Move the results to the hashtable

Builds the hashtable that will be used to populate the row. We could add each test to the file, but that would create a lot of white space. This builds that hash and then sends the hash to the file as a single row.

foreach ($Item in $Results)
{ 
  $Target = $Item.Address
  $TimeMS = $Item.ResponseTime
  $PingStat[$Target] = [string]$TimeMS
}

Export the hashtable to the file

Not much to say about this, but it could be a small function

$PingStat |
ForEach-Object -Process {
  [pscustomobject]$_
} |     
Export-Csv -Path $PingReport -NoTypeInformation -Force -Append

Test-Replication RegEx does not work now.

Describe the bug
est-Replication : Cannot validate argument on parameter 'TestFile'. The argument "\folder-1\test.txt" does not match
the "
\\.txt
" pattern. Supply an argument that matches "
\\.txt
" and try the command again.
At line:1 char:60

  • ... cation -DfsrServers Server1, server2 -TestFile '\folder-1\test.txt'
  •                                                  ~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Test-Replication], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Test-Replication

$time is a string and needs to be an [int]

Describe the bug
The math fails when $math*x

To Reproduce
Steps to reproduce the behavior:
Run the script with or without the $test param. It will error out as $time*2 not authorized.

Expected behavior
The script should "Sleep" for $time*x time based on whether the $test param is in place

Change the $time variable on lines 70 and 75 to:
[int]$time = 5
[int]$time = 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.