Windows 10: I Need Some Powershell Education

Discus and support I Need Some Powershell Education in Windows 10 Software and Apps to solve the problem; Since the days of an Autoexec.Bat and the Config.Sys, I've kept a directory/folder named Utilities for Batch Files and small programs that do not... Discussion in 'Windows 10 Software and Apps' started by Wiley Coyote, May 4, 2017.

  1. I Need Some Powershell Education


    Since the days of an Autoexec.Bat and the Config.Sys, I've kept a directory/folder named Utilities for Batch Files and small programs that do not require installation. It's always been on "the path" for obvious reasons. With the coming of CU and Powershell replacing the Command Prompt, I've been learning something about PS. It's been said that anything I can do from the Command Prompt, I can do in PS. Well I must have something wrong. Here's my setup now and none of my Batch Files or "little" programs run in PS:


    I Need Some Powershell Education [​IMG]



    I Need Some Powershell Education [​IMG]


    How do I get the Utilities folder in a path that PS will read?

    Thanks for any attention and help.

    :)
     
    Wiley Coyote, May 4, 2017
    #1

  2. Powershell - Need some help

    Hi Everyone,

    Currently I am pulling in data and parsing in powershell with a regex expression.

    $regex = [regex]
    "\b(?I Need Some Powershell Education :(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"

    $ipAddress = $regex.matches($log) |
    % { $_.value }

    The variable becomes a string. I am looking for a way to convert the ip addresses into objects, that I can pass into a url.

    $ipAddress =
    $regex.matches($log) |
    % { $_.value } | ConvertFrom-StringData
    $IPAddress -OutBuffer
    $ipAddressURL

    This is the output currently shown when I run the $ipAddress variable in powershell. I have looked and googled left and right but I am unsure how to separate these into objects and not string in PS. Can someone help?

    118.101.203.252

    24.10.216.192

    173.252.100.117

    173.252.114.114
    Thanks!

    Third.
     
    thirddementia, May 4, 2017
    #2
  3. Windows 10 education key

    You should be able to enter the key in Windows 10 Pro and be upgraded to Education. No need to reinstall Windows 10, your apps, files and settings preserved.

    Are you sure you want Education though? It has some limitations like Cortana is disabled by default and there might be some missing functions.

    Open Start > Settings > Update & security > Activation > change the product key

    Enter your Windows 10 Education key then click Next to upgrade.
     
    Andre Da Costa, May 4, 2017
    #3
  4. I Need Some Powershell Education

    This may or may not help but command prompt is till there. Settings > Personalization > Taskbar > Replace Command prompt with Power shell in the menu when I right click the start button. Set to Off to get the command prompt option.
     
    alphanumeric, May 4, 2017
    #4
  5. Hey, thanks for the comment. It is appreciated. I understand. I'm just trying to learn the coming changes and adapt to them. I do know "cmd" will still be available to be run from Powershell.
     
    Wiley Coyote, May 4, 2017
    #5
  6. I had a feeling you'd say that. *Smile I'm a total powershell noob. *Sad So much so that I switch it back to command prompt out of habit.
     
    alphanumeric, May 4, 2017
    #6
  7. So you know how I feel. *Huh
     
    Wiley Coyote, May 4, 2017
    #7
  8. Samuria Win User

    I Need Some Powershell Education

    Tons of tutors on YouTube for PowerShell
     
    Samuria, May 4, 2017
    #8
  9. Mystere Win User
    You appear to have misunderstood what I said earlier. CMD shell is not going away. The only thing that's gone away is the "Open CMD shell" from the file menu of File Explorer. CMD is still in the start menu, and you do not have to run it from within powershell.

    The point I was making was that you could click File->Open Windows Powershell and then do many of the common things, or run cmd from within powershell. You can still run a standard cmd console by going to start and typing cmd and a regular cmd prompt will open. You can also pin that to start or taskbar if you want.

    In any event, after you add a path to your environment variables, you have to start a new console or powershell window.
     
    Mystere, May 4, 2017
    #9
  10. Ah, I did misunderstand that one. You shouldn't scare old people like that.

    Hmmm. That path addition has been in place since right after I first booted this machine up.

    Humph! Something else I have to deal with. But I do have to admit it's entertaining and sometimes even a little fun.
     
    Wiley Coyote, May 4, 2017
    #10
  11. Pyprohly Win User
    CWGilley, could you elaborate?

    If I have a folder “C:\Utilities” in the path variable with batch and powershell scripts in it, I can specify just the name of the batch or powershell script in a powershell console and it will run. Is this what isn’t working for you?
     
    Pyprohly, May 5, 2017
    #11
  12. gpglang Win User
    SET PATH=C:\Utility;%PATH% should just work fine ( or using the GUI as you showed)
    Another trick is to always have your script go to the working directory, in my view mandatory ( did that also with Batch):
    $location = Split-Path ((Get-Variable MyInvocation -Scope 0).Value).MyCommand.Path
    Push-Location $location
    [Environment]::CurrentDirectory = $location
    <scriptcode>
    Pop-Location (if you have more lines below, make sure you are where you expect it.)

    Calling for scripts or apps, please read PowerShell and external commands done right // blog.edgylogic
    That one helped me A LOT!!!

    in my view ( and with the Batch experience of an old guy), Batch can do stuff with less code, normal OS things. But with conditions, functions (as we call them Procedures) and working with file-content, apps, Registry and what have you, I believe one has to start PS. So, chapeau for going there. There are indeed tons of info, have fun
     
    gpglang, May 5, 2017
    #12
  13. I Need Some Powershell Education

    That's right. None of the C:\Utilities do anything when I try to run them in PS. Here's what I get with $Archive.bat file:

    Windows PowerShell
    Copyright (C) 2016 Microsoft Corporation. All rights reserved.

    PS C:\Users\Clayton> cd\
    PS C:\> $Archive
    PS C:\>


    Even manually taking it to C:\ before the command gets nothing.

    gpglang, thanks for the link. I'm headed over there now.
     
    Wiley Coyote, May 5, 2017
    #13
  14. Pyprohly Win User
    Well there’s your problem. The dollar symbol is used to denote a variable in PowerShell.

    If you want to run that batch file with that special symbol in it, you’ll need to explicitly tell PowerShell you want to invoke it, so quote it and prepend an ampersand (the call operator).
    Code: PS> & '$Archive'[/quote]
     
    Pyprohly, May 5, 2017
    #14
  15. OK, bad example. Here's the simplest (and oldest) one I have named X.bat

    @ECHO Off
    CD\
    C:
    CLS
    Exit


    And it doesn't work either. Your code example does run. Thanks for that one.

    I'm starting to think/understand PS is an environment unto itself. Independent of Windows, CMD, and/or DOS.
     
    Wiley Coyote, May 5, 2017
    #15
Thema:

I Need Some Powershell Education

Loading...
  1. I Need Some Powershell Education - Similar Threads - Need Powershell Education

  2. I need some help with windows powershell for windows terminal

    in Windows 10 Software and Apps
    I need some help with windows powershell for windows terminal: Hello I have a new HP laptop using edge browers and on task manager the edge browser was using 5.6 MB of memory out of 8Mbs so I clicked on the edge and a drop down I saw all the different programs using all the MB's so I closed down windows terminal to free up around 30mb's....
  3. I need some help with windows powershell for windows terminal

    in Windows 10 Gaming
    I need some help with windows powershell for windows terminal: Hello I have a new HP laptop using edge browers and on task manager the edge browser was using 5.6 MB of memory out of 8Mbs so I clicked on the edge and a drop down I saw all the different programs using all the MB's so I closed down windows terminal to free up around 30mb's....
  4. I need some help with windows powershell for windows terminal

    in Windows 10 Gaming
    I need some help with windows powershell for windows terminal: Hello I have a new HP laptop using edge browers and on task manager the edge browser was using 5.6 MB of memory out of 8Mbs so I clicked on the edge and a drop down I saw all the different programs using all the MB's so I closed down windows terminal to free up around 30mb's....
  5. I need some help with windows powershell for windows terminal

    in Windows 10 Software and Apps
    I need some help with windows powershell for windows terminal: Hello I have a new HP laptop using edge browers and on task manager the edge browser was using 5.6 MB of memory out of 8Mbs so I clicked on the edge and a drop down I saw all the different programs using all the MB's so I closed down windows terminal to free up around 30mb's....
  6. I need some Help

    in Windows 10 Ask Insider
    I need some Help: Hello, i want an ISO of the Windows 10 18363.752 build but i can't find it anywhere in the internet so i am asking anyone who's in here: can anyone send me an ISO? submitted by /u/Icey677059 [link] [comments]...
  7. I need some assistance

    in Windows 10 Ask Insider
    I need some assistance: I’ve been having a problem with the windows 10 20h2 64bit update it’s constantly failing to update does anyone have a fix? submitted by /u/glowingE [link] [comments] https://www.reddit.com/r/Windows10/comments/k3xqin/i_need_some_assistance/
  8. I need some help

    in Windows 10 BSOD Crashes and Debugging
    I need some help: So, I'm wanting to buy an SSD for my laptop, it says the performance would increase dramatically. But the problem is, my laptop has terrible fps on Minecraft: Java edition, so, what should I do? My Laptop is a Toshiba satellite c55-b5100. Current Specs: Windows 10: Latest...
  9. I need some assistance.

    in Windows 10 Ask Insider
    I need some assistance.: Normally I wouldn't care to ask anyone for help because I want to try to do/fix stuff myself but this has me stumped. I never worried about windows updating bc I never had any need to but I tried to download the xbox application to my PC and it requires version 1903, I'm...
  10. I need some help.

    in AntiVirus, Firewalls and System Security
    I need some help.: So, I saw a ad that I clicked on. After, as soon that I saw some coding appearing and a Microsoft Alert logo, I immediately clicked off the page. Was that the right thing to do, or should I have used Task Manager to close it? What should I do now?...