Readme.txt

 
Where is the module installed locally
    - The module is contained in the module folder "CmxModule".
    - Concrete versions of the module are children of the module folder.
    - The module folder is contained in the official powershell installation folder for the current
     user. This folder can be evaluated in powershell via
    > [Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell"
    This is for example "D:\UserData\z0012stm\Documents\WindowsPowerShell".
    - For example the concrete version 1.8 of the module would be installed in path
    "D:\UserData\z0012stm\Documents\WindowsPowerShell\Modules\CmxModule\1.8".
 
    Powershell module folder structure:
    "MyDocuments" // powershell installation folder for the current user
        CmxModule // module folder
            1.7 // version folder
            1.8 // version folder
            LATEST // latest folder is a symbolic link which points to the latest version folder, in this case "1.8"
 
How to publish the module
    - Let's say you have the module installed in the official powershell installation folder for the
     current user. And you have some changes done to it, so you want to publish the next version "1.9".
    - Open the psd1 file and increment the "ModuleVersion" to "1.9".
    - Rename the version folder to "1.9" as well.
      Hint: The LATEST symlink is broken now. Delete it.
      Also the windows toolbar entry is broken. There's only the "Command" entry left,
      but "Open Folder" does not work any more.
       
    - Inside the version folder, delete the "PSGetModuleInfo.xml" file.
       
    - Run the "PublishToGallery.ps1" script via doubleclick. The module is published to the
    powershell gallery. The module can be found at the gallery as a nuget package.
    Hint: The powershell gallery should be registered by default. Run command
    > Get-PsRepository
    and check whether a gallery named "PSGallery" in listed.
    The SourceLocation should start with "https://www.powershellgallery.com".
    - Rename the version folder from "1.9" to "old". Now we
    can download the published module "1.9" from the powershell gallery to the local powershell
    installation folder.
    - Run the "Install.ps1" file via doubleclick to install the module from the gallery.
    - If the install succeeds you should see the folder "1.9" next to the "old" folder.
    - The folder "1.9" contains the official module.
     
See which module is currently published on the powershell gallery
    - In powershell run
    > Find-Module CmxModule
    This should return version, name and repository of the CmxModule.
    If "Repository" equals "PSGallery" we know the module is available in the powershell gallery.
    - Alternatively you could login to the powershell gallery.
    - Go to url "https://www.powershellgallery.com".
    - Sign in e.g. as user "tobias.goeckel@siemens.com". Use the business account!
    - In the search box "Search PowerShell packages" enter "CmxModule".
    - This should display the module and detailed information.
     
See which module version is currently install on the local machine
    - Run this command:
    > Get-Module CmxModule -ListAvailable
    This should return version and name of the module currently installed.
     
See which module version is currently imported into the powershell session
    - Run this command:
    > Get-Module CmxModule
    This should return version and name of the module currently imported into the running
    powershell session.
    If the module is not imported in the session, the command above returns $null.
     
Import the module into the powershell session
    Usually a module is auto-loaded into the session as soon as it is used, i.e. one of its
    functions is called. Nevertheless it is possible to explicitly load the module. To do this,
    run the following command:
    > Import-Module CmxModule -Force
     
How to prepare powershell to download modules from the powershell gallery
    Open PowerShell with Admin rights and check if NuGet is installed
    > Get-PackageProvider -Name NuGet
    You should see the name "NuGet" and the current version.
    Hint: Version 3.1.0.0 or higher is needed.
     
    If not installed, install it:
    > Install-PackageProvider -Name NuGet -Force
 
    Check if PowerShellGet is installed
    > Get-Module PowerShellGet -ListAvailable
 
    If not installed, install it:
    > Install-Module -Name PowerShellGet -Force -AllowClobber
    Hint: Version 2.2.5 or higher is needed.
     
How to get the module from the powershell gallery
    Open powershell as admin and run:
    > Install-Module -Name "CmxModule" -Repository "PSGallery" -Scope "CurrentUser" -Force
    The latest version of the module is installed to the powershell installation directory
    of the current user.
     
    Unfortunately the installation path to a module is dynamic as it contains the version folder.
    To create a static path which always points to the latest module you can create a symlink.
    First run command:
    > CmxGetVersion
    to enforce the module to load.
    Then run command:
    > CmxInstallationUpdateSymlinkFolder
    This command creates a symlink "LATEST" next to the latest version folder. This symlink is
    a constant path and will always point to the latest module installed for the current user.
     
How to configure CMX?
    The CMX configuration path is:
        C:\Users\z0012stm\AppData\Local\CmxModule
    In this directory is a "config.json" file. The "config.json" files stores the current TFS workspace. The workspace related CMX functions will be applied to the workspace currently configured in "config.json".
    The other files and folders in the configuration path have no relevance so far and are just used for backup.
     
    The configuration path can be read from the powershell console via
    > CmxGetConfigPath
     
    To see the config data which is currently read in to the current sessions, type the following command:
    > CmxWriteGlobals
     
    To update windows user name and password in the "config.json" file, you have to call:
    > CmxSaveWindowsCredential