From 439ea6a334a377fd7d1d9207863222f8b00bc805 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Tue, 19 Jul 2016 12:53:19 -0700 Subject: [PATCH 1/6] PowerShellGet demo script PowerShellGet demo script --- demos/PowerShellGet.ps1 | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 demos/PowerShellGet.ps1 diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 new file mode 100644 index 0000000000..2dae828719 --- /dev/null +++ b/demos/PowerShellGet.ps1 @@ -0,0 +1,59 @@ +Get-Command -Module PowerShellGet + +Get-PSRepository + +Register-PSRepository -Name PSGalleryINT -SourceLocation https://dtlgalleryint.cloudapp.net -InstallationPolicy Trusted + +Get-PSRepository + +Find-Module +Find-Module ContosoServer + +Save-Module ContosoServer -Path /tmp +Get-ChildItem -Path /tmp/ContosoServer -Recurse + +Install-Module -Name ContosoServer -RequiredVersion 1.5 -Scope CurrentUser +Get-InstalledModule +Get-Module -ListAvailable ContosoServer +Get-InstalledScript ContosoServer | Format-List * + +Install-Module -Name ContosoClient -RequiredVersion 1.0 -Scope CurrentUser +Get-InstalledModule ContosoClient +Get-Module -ListAvailable ContosoClient + +Update-Module ContosoClient -RequiredVersion 1.5 +Get-InstalledModule ContosoClient +Get-Module -ListAvailable ContosoClient + +Update-Module -WhatIf +Update-Module +Get-InstalledModule + +Get-InstalledModule ContosoClient -AllVersions +Uninstall-Module ContosoClient -RequiredVersion 1.0 +Get-InstalledModule ContosoClient -AllVersions + + +Find-Script +Find-Script -Name Fabrikam-ServerScript +Save-Script Fabrikam-ServerScript -Path /tmp +Get-ChildItem -Path /tmp/Fabrikam-ServerScript.ps1 + +'/tmp/Fabrikam-ServerScript.ps1' + +Find-Script -Name Fabrikam-ServerScript -RequiredVersion 2.0 | Install-Script -Scope CurrentUser +Get-InstalledScript + +Install-Script Fabrikam-ServerClient -RequiredVersion 1.0 -Scope CurrentUser +Get-InstalledScript + +Get-InstalledScript Fabrikam-ServerClient | Format-List * + +Update-Script -WhatIf +Update-Script +Get-InstalledScript + +Uninstall-Script Fabrikam-ServerClient -Verbose + + + From 1889ab18c5db067ffc7b77eabab6d47cf361fede Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Wed, 20 Jul 2016 18:35:52 -0700 Subject: [PATCH 2/6] Updating PowerShellGet demo --- demos/PowerShellGet.ps1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 index 2dae828719..e2c15cc389 100644 --- a/demos/PowerShellGet.ps1 +++ b/demos/PowerShellGet.ps1 @@ -2,10 +2,6 @@ Get-PSRepository -Register-PSRepository -Name PSGalleryINT -SourceLocation https://dtlgalleryint.cloudapp.net -InstallationPolicy Trusted - -Get-PSRepository - Find-Module Find-Module ContosoServer @@ -15,7 +11,7 @@ Get-ChildItem -Path /tmp/ContosoServer -Recurse Install-Module -Name ContosoServer -RequiredVersion 1.5 -Scope CurrentUser Get-InstalledModule Get-Module -ListAvailable ContosoServer -Get-InstalledScript ContosoServer | Format-List * +Get-InstalledModule ContosoServer | Format-List * Install-Module -Name ContosoClient -RequiredVersion 1.0 -Scope CurrentUser Get-InstalledModule ContosoClient From 5ba2a3b7b810b3bbf90fe64152a09dfedcb00440 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Tue, 19 Jul 2016 12:53:19 -0700 Subject: [PATCH 3/6] PowerShellGet demo script PowerShellGet demo script --- demos/PowerShellGet.ps1 | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 demos/PowerShellGet.ps1 diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 new file mode 100644 index 0000000000..2dae828719 --- /dev/null +++ b/demos/PowerShellGet.ps1 @@ -0,0 +1,59 @@ +Get-Command -Module PowerShellGet + +Get-PSRepository + +Register-PSRepository -Name PSGalleryINT -SourceLocation https://dtlgalleryint.cloudapp.net -InstallationPolicy Trusted + +Get-PSRepository + +Find-Module +Find-Module ContosoServer + +Save-Module ContosoServer -Path /tmp +Get-ChildItem -Path /tmp/ContosoServer -Recurse + +Install-Module -Name ContosoServer -RequiredVersion 1.5 -Scope CurrentUser +Get-InstalledModule +Get-Module -ListAvailable ContosoServer +Get-InstalledScript ContosoServer | Format-List * + +Install-Module -Name ContosoClient -RequiredVersion 1.0 -Scope CurrentUser +Get-InstalledModule ContosoClient +Get-Module -ListAvailable ContosoClient + +Update-Module ContosoClient -RequiredVersion 1.5 +Get-InstalledModule ContosoClient +Get-Module -ListAvailable ContosoClient + +Update-Module -WhatIf +Update-Module +Get-InstalledModule + +Get-InstalledModule ContosoClient -AllVersions +Uninstall-Module ContosoClient -RequiredVersion 1.0 +Get-InstalledModule ContosoClient -AllVersions + + +Find-Script +Find-Script -Name Fabrikam-ServerScript +Save-Script Fabrikam-ServerScript -Path /tmp +Get-ChildItem -Path /tmp/Fabrikam-ServerScript.ps1 + +'/tmp/Fabrikam-ServerScript.ps1' + +Find-Script -Name Fabrikam-ServerScript -RequiredVersion 2.0 | Install-Script -Scope CurrentUser +Get-InstalledScript + +Install-Script Fabrikam-ServerClient -RequiredVersion 1.0 -Scope CurrentUser +Get-InstalledScript + +Get-InstalledScript Fabrikam-ServerClient | Format-List * + +Update-Script -WhatIf +Update-Script +Get-InstalledScript + +Uninstall-Script Fabrikam-ServerClient -Verbose + + + From 7120cecc158813765ab3a089f9fd143a763f74df Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Wed, 20 Jul 2016 18:35:52 -0700 Subject: [PATCH 4/6] Updating PowerShellGet demo --- demos/PowerShellGet.ps1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 index 2dae828719..e2c15cc389 100644 --- a/demos/PowerShellGet.ps1 +++ b/demos/PowerShellGet.ps1 @@ -2,10 +2,6 @@ Get-PSRepository -Register-PSRepository -Name PSGalleryINT -SourceLocation https://dtlgalleryint.cloudapp.net -InstallationPolicy Trusted - -Get-PSRepository - Find-Module Find-Module ContosoServer @@ -15,7 +11,7 @@ Get-ChildItem -Path /tmp/ContosoServer -Recurse Install-Module -Name ContosoServer -RequiredVersion 1.5 -Scope CurrentUser Get-InstalledModule Get-Module -ListAvailable ContosoServer -Get-InstalledScript ContosoServer | Format-List * +Get-InstalledModule ContosoServer | Format-List * Install-Module -Name ContosoClient -RequiredVersion 1.0 -Scope CurrentUser Get-InstalledModule ContosoClient From 9527193920933796752b460c674f84c228c940ef Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Thu, 21 Jul 2016 13:00:41 -0700 Subject: [PATCH 5/6] PowerShellGet demo PowerShellGet demo --- demos/PowerShellGet.ps1 | 79 +++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 index e2c15cc389..5f418aec7f 100644 --- a/demos/PowerShellGet.ps1 +++ b/demos/PowerShellGet.ps1 @@ -1,55 +1,74 @@ -Get-Command -Module PowerShellGet +#region cleanup +Get-InstalledModule PSScriptAnalyzer -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module +Get-InstalledModule xJea -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module +Get-InstalledScript Fabrikam-Script -ErrorAction SilentlyContinue | Uninstall-Script +Get-InstalledScript Start-Demo -ErrorAction SilentlyContinue | Uninstall-Script +Remove-Item /tmp/PSScriptAnalyzer -Force -Recurse -ErrorAction SilentlyContinue +Remove-Item /tmp/Start-Demot.ps1 -Force -ErrorAction SilentlyContinue -Get-PSRepository +#endregion +# List of PowerShellGet commands +Get-Command -Module PowerShellGet + +# Discover modules Find-Module -Find-Module ContosoServer +Find-Module PSScriptAnalyzer -Save-Module ContosoServer -Path /tmp -Get-ChildItem -Path /tmp/ContosoServer -Recurse +# Save a module to the local machine +Save-Module PSScriptAnalyzer -Path /tmp +Get-ChildItem -Path /tmp/PSScriptAnalyzer/1.6.0/ -Recurse -Install-Module -Name ContosoServer -RequiredVersion 1.5 -Scope CurrentUser +# Install a module to the common modules location +Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.0.2 -Scope CurrentUser + +# Discover the installed modules Get-InstalledModule -Get-Module -ListAvailable ContosoServer -Get-InstalledModule ContosoServer | Format-List * +Get-Module -ListAvailable PSScriptAnalyzer +Get-InstalledModule PSScriptAnalyzer | Format-List * -Install-Module -Name ContosoClient -RequiredVersion 1.0 -Scope CurrentUser -Get-InstalledModule ContosoClient -Get-Module -ListAvailable ContosoClient +# Install xJea module +Install-Module -Name xJea -RequiredVersion 0.2 -Scope CurrentUser +Get-InstalledModule xJea +Get-Module -ListAvailable xJea -Update-Module ContosoClient -RequiredVersion 1.5 -Get-InstalledModule ContosoClient -Get-Module -ListAvailable ContosoClient +# Update a module +Update-Module xJea -RequiredVersion 0.2.5 +Get-InstalledModule xJea +Get-Module -ListAvailable xJea +# Update all modules Update-Module -WhatIf Update-Module Get-InstalledModule -Get-InstalledModule ContosoClient -AllVersions -Uninstall-Module ContosoClient -RequiredVersion 1.0 -Get-InstalledModule ContosoClient -AllVersions - +# Uninstall a module version +Get-InstalledModule xJea -AllVersions +Uninstall-Module xJea +Get-InstalledModule xJea -AllVersions +# Discover PowerShell Scripts Find-Script -Find-Script -Name Fabrikam-ServerScript -Save-Script Fabrikam-ServerScript -Path /tmp -Get-ChildItem -Path /tmp/Fabrikam-ServerScript.ps1 +Find-Script -Name Start-Demo -'/tmp/Fabrikam-ServerScript.ps1' +# Save scripts to a specified location +Save-Script Start-Demo -Path /tmp +Get-ChildItem -Path /tmp/Start-Demot.ps1 -Find-Script -Name Fabrikam-ServerScript -RequiredVersion 2.0 | Install-Script -Scope CurrentUser +& '/tmp/Start-Demo.ps1' + +# Install a script to the common scripts location +Find-Script -Name Start-Demo | Install-Script -Scope CurrentUser Get-InstalledScript -Install-Script Fabrikam-ServerClient -RequiredVersion 1.0 -Scope CurrentUser +Install-Script Fabrikam-Script -RequiredVersion 1.0 -Scope CurrentUser Get-InstalledScript +Get-InstalledScript Fabrikam-Script | Format-List * -Get-InstalledScript Fabrikam-ServerClient | Format-List * - +# Update the installed scripts Update-Script -WhatIf Update-Script Get-InstalledScript -Uninstall-Script Fabrikam-ServerClient -Verbose - - - +# Uninstall a script file +Uninstall-Script Fabrikam-Script -Verbose From b1963fe5b20ddb5e2669090ddd8bc0a93084c52e Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Thu, 21 Jul 2016 14:52:11 -0700 Subject: [PATCH 6/6] Updating the demo script. --- demos/PowerShellGet.ps1 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/demos/PowerShellGet.ps1 b/demos/PowerShellGet.ps1 index 5f418aec7f..873e9a66f6 100644 --- a/demos/PowerShellGet.ps1 +++ b/demos/PowerShellGet.ps1 @@ -16,11 +16,11 @@ Find-Module Find-Module PSScriptAnalyzer # Save a module to the local machine -Save-Module PSScriptAnalyzer -Path /tmp +Save-Module PSScriptAnalyzer -Repository PSGallery -Path /tmp Get-ChildItem -Path /tmp/PSScriptAnalyzer/1.6.0/ -Recurse # Install a module to the common modules location -Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.0.2 -Scope CurrentUser +Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.0.2 -Scope CurrentUser -Repository PSGallery # Discover the installed modules Get-InstalledModule @@ -52,13 +52,11 @@ Find-Script Find-Script -Name Start-Demo # Save scripts to a specified location -Save-Script Start-Demo -Path /tmp -Get-ChildItem -Path /tmp/Start-Demot.ps1 - -& '/tmp/Start-Demo.ps1' +Save-Script Start-Demo -Repository PSGallery -Path /tmp +Get-ChildItem -Path /tmp/Start-Demo.ps1 # Install a script to the common scripts location -Find-Script -Name Start-Demo | Install-Script -Scope CurrentUser +Find-Script -Name Start-Demo -Repository PSGallery | Install-Script -Scope CurrentUser Get-InstalledScript Install-Script Fabrikam-Script -RequiredVersion 1.0 -Scope CurrentUser