Git Product home page Git Product logo

powershell-tuneup's Introduction

Repository Information

For help and/or information on my PowerShell Core setup head to the Development tab on my site: https://danamw.github.io


PowerShell-TuneUp

A couple notes about my scripts. I use "SET-ALIAS SAY WRITE-HOST" in all my scripts. So include that in your profile or edit all the SAY to WRITE-HOST, and edit out all the color codes. Lastly I Use the PowerShell environment $ENV:BASE in all my scripts. This is your base *.ps1 script folder. Feel free to write me an DanaMW at gmail.com if you want help. But I think just checking out the script will do it for ya. I wanted to mention that BinSM and DelaySM are a good example for writing to and reading from json files with PowerShell. Instructions on the net sucked but I worked it out and those two files work perfectly so you should have what you need to clip them and add them to your

PowerShell Scripts and snips for the learning curve. ALL are working in PowerShell Core 6.x unless they say otherwise. If you have improvements to them please share them with me, thats what this is about for me. Hope they help someone else. Enjoy. NOTE: In a lot of the scripts here I use console window resizing code. If you get weird error(s) just make the window larger than the displayed script and hit enter. In a perfect world will resize to the size of the script display. Same thing with the Settings Managers Note: I also use calls to Put-Pause, Put-WinPosition, Clearlogs Run-Checkdisk AND ASAY and/or Notify (which uses BurntToast- see below) Add them to the $env:BASE folder or edit out the calls.


BinMenu

Bin Menu is a simple console based menu that reads in what EXE's are in the base sub-folders and which PS1's are in the base and lists them on a menu for you. Comes with a Settings Manager script that's deals with the BinMenu.json settings and Adds. You can add your own entries to the end of the program menu list if you want up to 100. There is a toggle to show the add entries or not. Edit the json put the bin files in your base folder and run it. It will automatically run you through creating the INI it uses to store the Program Menu file list in. Have fun I did. And it works I use it EVERY day. (Structure of my bin folder is c:\bin is in my path and contains all my ps1 scripts. Then in all the sub folders of bin are all my programs I use that are portable. The list in the picture below sums it up.) See more extensive description in the readme in the folder. For Updates check the description in the readme in the BinMenu folder.

  • Usage: BINMENU

BinMenu

BinMenu


Write-Color (WC) and Write-ColorPrompt (WCP)

Functions added To Profile For New Coloring Method. I use the "" now. Not the "#" WC "#redword1~ greenword 2~" Go to my website on the development tab for copies of my profiles. You might even find some help there, who knows.


MiniMenu

This is a simple menu that you just edit in the options and then the commands to run. Then you just run the menu and pick the option. You should have nearly unlimited options room limited only by memory.

  • Usage: MiniMenu

Nano

This is a simple call to nano in Windows WSL bash. It convert a windows path into a linux one and opens the file to edit. The routines in this script with strip off "." if your indicating a file in the current folder. You can do it without that bit if you use tab expanding of files/folders I stripped it out for us.

  • Usage: nano Filename.txt
  • Usage: nano C:\Windows\Filename.txt

Check-Prof

This is a simple script to display the path of your profile files. It is an example of reading and writing files along with simple formatting. It requires Write-Color in your profile.ps1 and the external script of Remove-Empty.ps1

  • Usage: Check-Prof

Convert-Script

This is my user.CSS to user.JS UserStyle to UserScript converter. It is for use on scripts that you need to covert for use in Tampermonkey or any of the *monkey JS injection extensions. One example of a good use is for Old Edge browser. Update: Can convert VERY large files now. I don't read the whole file in now I read it in one line at a time so files can be huge. I open this script up and scared my self lol. I had written it very near the beginning of my learning curve I COMPLETELY rewrote it. Much smaller WAY safer and incredibly faster. NOW it deserves to be a public facing script.

  • Usage: Convert-Script1 -INFILE -OUTFILE
  • Usage: Convert-Script `

Imageto64

Feed it a filename of a image file and it feeds you back the base64 info ready to put into your script files.

  • Usage: IMAGETO64 -Path -OutFile `

Clearlogs

This clears most to all of your windows logs for you. (All of them except locked or in use as we fly by them). Update: Added Write Progress to the script so that there is some interaction with users in the form of a Progress Bar. Added the [bool] $Loud so that you can see the Verbose output. Clearlogs -Loud 1 or -Loud $True. It now gets the total number of log files, sets the math for the Progress bar and runs the routines. It also checks if it is ADMIN (Elevated) and if not, Elevates and runs. (It needs to be admin to delete clear logs). Should work for everyone well now. Added my own super simple progress bar that you can change the progress character. Updated to Version 2.

  • Usage: CLEARLOGS

Get-Files

A script I call from the other scripts. Just a DIR sort of replacement. With colors.

  • Usage: GET-FILES
  • Usage: GET-FILES . or with no parmeters (Displays current folder)

Get-SysInfo

A simple system information example containing how to expand a looped composed ($var + #) variable, and how to draw out simple info using Get-CimInstance. Updated yo only use Get-CimInstance.

  • Usage: GET-SYSINFO

SysInfo


Put-Input

This is new for PowerShell Core 7 and allows you to have a WinForm dialog for input. Make sure you have the newest DotNet SDK's.

  • Usage: Put-Input
  • Usage: Put-Input "Any text you want on the dialog:"
  • Usage: $ans = Put-Input "What is your answer this this question?"

Put-Pause

I Wanted something to replace Read-Host that timed out for my scripts. Added -Max 0 When you use -Max 0 the prompt does not time out and continues to wait for a keypress. -Default is disabled and -Echo is set to True. Added a clear keyboard buffer to catch extra input and throw it away. It now uses the color method Write-ColorPrompt (WCP) Changed the Separator from # to ~.

  • Usage: Put-Pause -Prompt <String> -Max <Milliseconds> -Default <single key default>
  • Usage: Put-Pause -Prompt "[Make A Selection]: "
  • Usage: $a = Put-Pause -Prompt "Do you seem interested? (Y/N): " -Default "N"
  • Color Usage: Put-Pause -Prompt "~white~Clear the Screen?~ ~cyan~(~~white~Y~~cyan~/~~white~N~~cyan~)~~white~:~ "
  • Color Usage: Put-Pause -Prompt "~white~Clear the Screen?~ ~cyan~(~~white~Y~~cyan~/~~white~N~~cyan~)~~white~:~ " -Max 0

Put-Vivaldi

I use Vivaldi browser sometimes because it, like Firefox, can have a custom user interface. My only beef was that they update it a lot and I would have to edit the files and copy over the custom css to add my changes every time they did. Well this script does the changes for me. You will only need to edit the top two folders in the script once. Add your custom css and your Vivaldi install base folder then just run it.

  • Usage: Put-Vivaldi

Put-WinSize (Formally Set-WinSize)

My script paste-in that allows the console buffer and window to be resized. I tried 3 or 4 from others and they didn't work so I put this together and use it because it simply works. (Going to turn it into a Function soon) Update: Moved it closer to a function, Working well.

  • Usage: Paste into your script file as a function and call to it.`

Put-Winposition

This will set a named window to the desired position.

  • Usage: Put-WinPosition -WinName -WinX -WinY Optionally
  • Usage: Put-WinPosition -WinName -WinX -WinY -Width -height

Discord Stuff

Here is where I put any Discord related PowerShell script stuff.


Google

This is my console script example that sends your search to Google in the browser. You can add IMAGE, VIDEO or NEWS to the beginning of the line to go directly to those search pages.

  • Usage: GOOGLE Searches ALL normally.
  • Usage: GOOGLE IMAGE
  • Usage: GOOGLE VIDEO
  • Usage: GOOGLE NEWS

Remove-Empty

Remove-Empty is a simple little script that removes all empty Lines in a given text file. Feed it a file and all the blank lines are removed.

  • Usage: REMOVE-EMPTY

Remove-WindowsApps

Remove-WindowsApps deletes Windows 10 apps from your system. Also makes it so they shouldn't reinstall by removing AppX Provisioning. Edit the file and comment out those that you want to keep.

  • Usage: REMOVE-WINDOWSAPPS

ASAY and NOTIFY

This now uses BurntToast from the PowerShellGallery

https://www.powershellgallery.com/packages/BurntToast

ASAY and NOTIFY are really the same file. They will send a notification to the standard windows notification center. I use it in my scripts to let me know when any event has happened I might want to see. The format is simple, without quote ASAY or WITH quotes if you use punctuation ASAY "This text, and that text" I also call these scripts from a LOT of my scripts to give notifications on windows 10. There is also a Linux and Dos version. The Linux files you need to edit and put your username over mine and edit atune to set the path to a valid sound file.

  • Usage: NOTIFY or ASAY
  • Usage: NOTIFY or ASAY <"message to send, include punctuation, to output">
  • Usage: Linux: Without Quotes do notify [] or asay []

Search

Search is a script that searches any text, as a filename parameter, in the path you give. From the whole drive down to just a folder it will list all matches found.

  • Usage: SEARCH [ (The star is added automatically)

Edit-Config

This is my generic read and write to json files as config files.

  • Usage: Edit-Config -Confile [string] -Count [string] -Read [string] -Write [string] -Section [string] -SValue [string] -BValue [bool] -Sub [int]

Env (environment)

This is my script to list a (one) environment variable from system ENV variable (no quotes) or from the variable drive ENV 'variable' (single quote) If you just do ENV it will list ALL variable

  • Usage: ENV (Does all variables)
  • Usage: ENV (Without quotes)
  • Usage: ENV <'VaribleToSearch'> (With single quote)(Works on variable drive)

Ver (Version)

I was missing the sort of version program I wanted so here it is. Just type VER.

  • Usage: VER.PS1

Reboot

I wanted (needed) a reboot command in windows. So TaDA :) It is used REBOOT.PS1 STOP|SHUTDOWN|RESTART|REBOOT Just REBOOT alone is the same as REBOOT RESTART I also call this script from the BinMenu above. I removed rebooting on REBOOT with no parameter. REBOOT.ps1 REBOOT is now required.

  • Usage: REBOOT STOP or REBOOT SHUTDOWN
  • Usage: REBOOT RESTART or REBOOT REBOOT

Run-CheckDisk

This script is my once a week CHKNTFS routine. It Sets drive C: and D: dirty then reboots to preform the disk check. I also call this script from the G QuickMenu of the BinMenu above. NOTE: Check out the script because it DOES NOT ask again it JUST RUNS. But it does what it should. It Will produce a message in Windows that you need to reboot to check the drives, which is the idea.

  • Usage: RUN-CHECKDISK.PS1

Repair-windows

This is just a pretty console menu for SCF and DISM. I wrote it for my family and friends with plenty of help and explanations to get them through running it correctly. It includes the 4 normal possibilities. And we all have used it hundreds of times to make sure our Windows 10 was operating well.

  • Usage: REPAIR-WINDOWS.PS1 (Runs Menu)
  • Usage: REPAIR-WINDOWS.PS1 SCAN
  • Usage: REPAIR-WINDOWS.PS1 Check
  • Usage: REPAIR-WINDOWS.PS1 REPAIR
  • Usage: REPAIR-WINDOWS.PS1 RESET

Repair-Windows

Repair-Windows

powershell-tuneup's People

Contributors

danamw avatar

Watchers

 avatar  avatar

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.