Powershell Tips and Tricks

Discussion in 'Software' started by Adrynalyne, Jul 22, 2015.

  1. Adrynalyne

    Adrynalyne Guest

    I figured I would start a thread on this, especially since theefool and I have a common interest in it. I've written all sorts of things in PS, including hitting web service endpoints, but I figured a general tip thread was in order.

    Enable profile:
    Code:
    New-item –type file –force $profile
    The profile file will be kept under Documents/WindowsPowershell. You may need to set the execution policy before using it:

    Code:
    Set-ExecutionPolicy RemoteSigned 
    
    RemoteSigned still keeps you safe. Scripts online are required to be signed.


    Windows 10 only:
    Hitting the 'up' key on your keyboard brings back command history, even from prior sessions.

    Windows 10 only
    Set transparency:

    --Right click title bar, go to layout and adjust opacity.

    Set default directory for powershell:

    Inside your powershell profile, add the following:
    Code:
    set-location c:\<path>
    
    Where <path> is the location of the default folder.


    Create an easier New-Item command:

    In Gnu/Linux or UNIX, we use touch.
    Code:
    set-alias touch New-Item
    
    Put it in your profile.

    Then to create a new file of any type:

    PS C:\AppDev> touch test2.txt


    Directory: C:\AppDev


    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    -a---- 7/22/2015 6:55 PM 0 test2.txt


    List more tips if you have em!
     
  2. Adrynalyne

    Adrynalyne Guest

    My profile:
     

    Attached Files:


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds