none
Need some help with a script (New to Powershell) RRS feed

  • Question

  • I have this script that I am trying to MS-DOS convert to Powershell. However, I'm not sure where to begin with the Powershell commands. I am hoping that by posting a small section of the script you'll can help give me examples on who to convert it.

    The script I'm trying to convert is as follows:

    @echo off

    cls

    set /p PSCUST="Enter Customer Name: "

    set /p PROJ="Enter Project Number: "

    set /p TYPE="Enter New or Replacement: "

    if exist %~dp0%PSCUST%\releases\%TYPE%_%PSCUST%_%PROJ%_full_v1.0.0\nul goto skipthis

    md ".\%PSCUST%\releases\%TYPE%_%PSCUST%_%PROJ%_full_v1.0.0"

    Echo Creating working %PSCUST%....

    echo:

    xcopy .\_root_of_PS_zip_release_package\*.*

    ".\%PSCUST%\releases\%TYPE%_%PSCUST%_%PROJ%_full_v1.0.0\*.*" /h/e/c/k/y/r

    echo: This is to create a local directory structure

    md "C:\MyCustomers\%PSCUST%\Books"

    md "C:\MyCustomers\%PSCUST%\Phone"

    md "C:\MyCustomers\%PSCUST%\Address"

    Echo Creating Local working directory structure %PSCUST%

    echo f | xcopy ".\_Samples\SampleCustomerInformation.txt"

    "C:\MyCustomers\%PSCUST%\%PSCUST%_CustomerInformation.txt" /h/e/c/k/y/r

    %extd% /download https://www.MyCustomerSharePoint.com/SampleCustomerRequirements.docx

    "C:\MyCustomers\%PSCUST%\%PSCUST%_CustomerRequirements.docx"

    goto byebye

    :skipthis

    echo

    :echo

    :Echo This customer already seems to exist.

    echo

    :echo

    ::byebye

    Can you please point me in the right direction for converting and gaining an understanding of the PowerShell Commandlets?

    Thanks,

    Richard


    Richard Underwood


    Monday, September 12, 2016 7:40 PM

Answers

  • Hi There,

    This would be an good start:

    https://mva.microsoft.com/en-us/training-courses/getting-started-with-powershell-3-0-jump-start-8276?

    But for the ultimate training i would highly recommend

    The Video Version:

    https://www.cbtnuggets.com/it-training/microsoft-windows-powershell-2-3-4

    Or the book Version:

    https://morelunches.com/2012/11/01/learn-powershell-3-in-a-month-of-lunches-2nd-ed/

    i could help you with building this to a Command and from there to A cmdlet(aka Function) and from there to an module.  Only it highly addictive to learn powershell and build it you're self. and specially if you have a goal to achieve. 

    If you could use the help please let me know

    Monday, September 12, 2016 7:50 PM
  • Yes, Mike Laughlin I understand what the code is doing and how it works. However, I do not understand how to get started with Windows Powershell which is why I'm here asking for help.

    Okay, that's good and will make your journey easier.

    There are good resources here for starting with PowerShell:

    http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx

    There is also a good command reference here:

    http://ss64.com/ps/


    Monday, September 12, 2016 8:06 PM

All replies

  • Why do you need to convert the script? If it works the way you want, just keep using it.

    As an aside, this isn't a free "code conversion" service.


    -- Bill Stewart [Bill_Stewart]

    Monday, September 12, 2016 7:48 PM
    Moderator
  • Hi There,

    This would be an good start:

    https://mva.microsoft.com/en-us/training-courses/getting-started-with-powershell-3-0-jump-start-8276?

    But for the ultimate training i would highly recommend

    The Video Version:

    https://www.cbtnuggets.com/it-training/microsoft-windows-powershell-2-3-4

    Or the book Version:

    https://morelunches.com/2012/11/01/learn-powershell-3-in-a-month-of-lunches-2nd-ed/

    i could help you with building this to a Command and from there to A cmdlet(aka Function) and from there to an module.  Only it highly addictive to learn powershell and build it you're self. and specially if you have a goal to achieve. 

    If you could use the help please let me know

    Monday, September 12, 2016 7:50 PM
  • Because it doesn't fully work and part of the code no longer works.


    Richard

    Monday, September 12, 2016 7:57 PM
  • Because it doesn't fully work and part of the code no longer works.


    Richard

    Do you understand what it's supposed to do in the first place? If so, you can likely convert it. If not, you're probably out of luck.


    Monday, September 12, 2016 7:58 PM
  • Hello Julien,

    Thanks for your offer to help me convert the code. Yes, I could use your help it'll help me understand and I have several more modules to convert to PowerShell. I just need a little help getting started.

    I shall take a look at your resources that you've recommended.

    Again Thanks,


    Richard

    Monday, September 12, 2016 7:59 PM
  • Yes, Mike Laughlin I understand what the code is doing and how it works. However, I do not understand how to get started with Windows Powershell which is why I'm here asking for help.

    Thanks for your quick response,


    Richard

    Monday, September 12, 2016 8:03 PM
  • Yes, Mike Laughlin I understand what the code is doing and how it works. However, I do not understand how to get started with Windows Powershell which is why I'm here asking for help.

    Okay, that's good and will make your journey easier.

    There are good resources here for starting with PowerShell:

    http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx

    There is also a good command reference here:

    http://ss64.com/ps/


    Monday, September 12, 2016 8:06 PM