Powershell profile Creation

vinay vernekar 1 Reputation point

Need to create Powershell Profile and Every time start it should ask to load profile Y or N. it should load only when i type Y.
Can someone help me!

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,435 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 14,011 Reputation points MVP

    Hi @vinay vernekar
    Please refer the settings on the below url.
    How To Create PowerShell Profile Step by Step with Examples

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    0 comments No comments

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 32,326 Reputation points Microsoft Vendor


    Try adding this to your profile:

    $input=Read-Host -Prompt 'Do you want to load the profile?'  
    if($input -eq 'Y'){  
    #contents of the profile  

    This cannot stop the profile from being loaded but it makes powershell load nothing from the profile if you don't type Y.

    Best Regards,
    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments