|
| 1 | +# uplift-powershell |
| 2 | +This repository contains reusable PowerShell modules used in the uplift project. |
| 3 | + |
| 4 | +The uplift project offers consistent Packer/Vagrant workflows and Vagrant boxes specifically designed for SharePoint professionals. It heavy lifts low-level details of the creation of domain controllers, SQL servers, SharePoint farms and Visual Studio installs by providing a codified workflow using Packer/Vagrant tooling. |
| 5 | + |
| 6 | +## How this works |
| 7 | +The uplift project is split into several repositories to address particular a piece of functionality: |
| 8 | + |
| 9 | +* [uplift-powershell](https://github.com/SubPointSolutions/uplift-powershell) - reusable PowerShell modules |
| 10 | +* [uplift-packer](https://github.com/SubPointSolutions/uplift-packer) - Packer templates for SharePoint professionals |
| 11 | +* [uplift-vagrant](https://github.com/SubPointSolutions/uplift-vagrant) - Vagrant plugin to simplify Windows infrastructure provisioning |
| 12 | + |
| 13 | +The current repository houses reusable PowerShell modules which are used in both Packer builds and Vagrant boxes across the uplift project. |
| 14 | + |
| 15 | +## PowerShell modules |
| 16 | +Currently, there are several PowerShell modules which live in the root folder: |
| 17 | +* /uplift.core - internal utilities for uplift project automation |
| 18 | +* /invoke-uplift - general purpose downloading tool |
| 19 | + |
| 20 | +While `uplift.core` module is used for internal automation and should not be used publically, `invoke-uplift` provides a PowerShell6 module which handles file based routines: downloading files, validating checksum, creating a local repository of all downloaded files, transferring files into Packer/Vagrant VMs. |
| 21 | + |
| 22 | +### Uplift.Core |
| 23 | +`uplift.core` is a PowerShell module which simplifies automation tasks within the uplift project. It can but should not be used publically. For the reference, refer to existing PowerShell scripts and all `XXX-UpliftXXX` methods used. |
| 24 | + |
| 25 | +### Invoke-Uplift |
| 26 | +`invoke-uplift` is a PowerShell6 module which simplifies file based routines. It is a general purpose tool and can be used freely to automate file downloads, checksum validation, file service and transferring. It is built with PowerShell 6 which makes it portable across platforms; it works well on Windows and MacBook laptops, and even under Windows 2008. |
| 27 | + |
| 28 | +`invoke-uplift` is a PowerShell6 module which simplifies file based routines. It is a general purpose tool and can be used freely to automate file downloads, checksum validation, file service and transferring. For example, `json` configuration can be used to specify which files to download. `invoke-uplift` will build a local repository with downloaded files which then can be used to serve files locally or uploaded to Azure/AWS storages. |
| 29 | + |
| 30 | +This module is an essential part of the uplift project. We rely heavily on its automation to download and build local repository containing all ISOs, installation media, service packs and patches. Refer to following commands to get started: |
| 31 | + |
| 32 | +#### Installing `Invoke-Uplift` |
| 33 | +```powershell |
| 34 | +# subpointsolutions-staging on myget.org |
| 35 | +# https://www.myget.org/feed/subpointsolutions-staging/package/nuget/InvokeUplift |
| 36 | +
|
| 37 | +# register 'subpointsolutions-staging' repository |
| 38 | +Register-PSRepository -Name "subpointsolutions-staging" -SourceLocation "https://www.myget.org/F/subpointsolutions-staging/api/v2" |
| 39 | +
|
| 40 | +# install module under PowerShell 6 |
| 41 | +pwsh -c 'Install-Module -Name "InvokeUplift" -Repository "subpointsolutions-staging"' |
| 42 | +``` |
| 43 | + |
| 44 | +#### Using `Invoke-Uplift` |
| 45 | +```powershell |
| 46 | +
|
| 47 | +# don't forget to switch to pwsh or use pwsh -c 'my-command' all the time |
| 48 | +pwsh |
| 49 | +
|
| 50 | +# default run, version and help |
| 51 | +invoke-uplift |
| 52 | +invoke-uplift version |
| 53 | +invoke-uplift help |
| 54 | +``` |
| 55 | + |
| 56 | +#### Listing and downloading default resource |
| 57 | +`Invoke-Uplift` provides more than a hundred file resources which can be used straight away. These are SharePoint media, ISOs, service packs, updates, parches and others. |
| 58 | + |
| 59 | +```powerhell |
| 60 | +invoke-uplift resource list |
| 61 | +``` |
| 62 | + |
| 63 | +Once you know which resource to download, use resource name with `resource download` command: |
| 64 | + |
| 65 | +```powerhell |
| 66 | +# download resource by name |
| 67 | +invoke-uplift resource download 7z-1805-x64 |
| 68 | +invoke-uplift resource download 7z-1805-x64 |
| 69 | +
|
| 70 | +# download resource by name match, wildcard is used |
| 71 | +invoke-uplift resource download 7z- |
| 72 | +``` |
| 73 | + |
| 74 | +By default, `invoke-uplift` downloads files into `uplift-local-repository` folder within the directory where it was run. This can be changes by using `-r` or `-repository` option: |
| 75 | + |
| 76 | + |
| 77 | +```powerhell |
| 78 | +# download resource into a local folder |
| 79 | +invoke-uplift resource download 7z-1805-x64 -r c:/my-files-repository |
| 80 | +
|
| 81 | +# download resources into a local folder |
| 82 | +invoke-uplift resource download 7z-1805-x64 -repository c:/my-files-repository |
| 83 | +``` |
| 84 | + |
| 85 | +Default resource provides by `invoke-uplift` can be found in the source code: |
| 86 | +* uplift-powershell\invoke-uplift\src\resource-files |
| 87 | + |
| 88 | +``` |
| 89 | + - 7z-1805-x64 |
| 90 | + - 7z-1805-x86 |
| 91 | + - hashicorp-packer-1.3.3-win |
| 92 | + - hashicorp-packer-1.3.3-darwin |
| 93 | + - hashicorp-packer-1.3.2-win |
| 94 | + - hashicorp-packer-1.3.2-darwin |
| 95 | + - hashicorp-vagrant-2.2.3-win |
| 96 | + - hashicorp-vagrant-2.2.3-osx |
| 97 | + - hashicorp-vagrant-2.2.2-win |
| 98 | + - hashicorp-vagrant-2.2.2-osx |
| 99 | + - hashicorp-vagrant-2.1.0-win |
| 100 | + - hashicorp-vagrant-2.1.0-osx |
| 101 | + - jetbrains-resharper-ultimate-2018.3.1 |
| 102 | + - jetbrains-resharper-ultimate-2018.1.2 |
| 103 | + - ms-dynamics-crm2016-server |
| 104 | + - ms-sharepoint2013-foundation |
| 105 | + - ms-sharepoint2013-rtm |
| 106 | + - ms-sharepoint2016-fp2 |
| 107 | + - ms-sharepoint2016-rtm |
| 108 | + - ms-sharepoint2016-lang-pack-ar-sa |
| 109 | + - ms-sharepoint2016-lang-pack-cs-cz |
| 110 | + - ms-sharepoint2016-lang-pack-da-dk |
| 111 | + - ms-sharepoint2016-lang-pack-en-us |
| 112 | + - ms-sharepoint2016-lang-pack-de-de |
| 113 | + - ms-sharepoint2016-lang-pack-fr-fr |
| 114 | + - ms-sharepoint2016-lang-pack-fi-fi |
| 115 | + - ms-sharepoint2016-lang-pack-nl-nl |
| 116 | + - ms-sharepoint2016-lang-pack-he-il |
| 117 | + - ms-sharepoint2016-lang-pack-hi-in |
| 118 | + - ms-sharepoint2016-lang-pack-kk-kz |
| 119 | + - ms-sharepoint2016-lang-pack-it-it |
| 120 | + - ms-sharepoint2016-lang-pack-lv-lv |
| 121 | + - ms-sharepoint2016-lang-pack-pl-pl |
| 122 | + - ms-sharepoint2016-lang-pack-ru-ru |
| 123 | + - ms-sharepoint2016-lang-pack-ro-ro |
| 124 | + - ms-sharepoint2016-lang-pack-es-es |
| 125 | + - ms-sharepoint2016-lang-pack-sv-se |
| 126 | + - ms-sharepoint2016-lang-pack-uk-ua |
| 127 | + - ms-sharepoint2016-update-2016.11.08-KB3127940 |
| 128 | + - ms-sharepoint2016-update-2016.11.08-KB3127942 |
| 129 | + - ms-sharepoint2016-update-2016.12.13-KB3128014 |
| 130 | + - ms-sharepoint2016-update-2016.12.13-KB3128017 |
| 131 | + - ms-sharepoint2016-update-2017.01.10-KB3141486 |
| 132 | + - ms-sharepoint2016-update-2017.01.10-KB3141487 |
| 133 | + - ms-sharepoint2016-update-2017.02.14-KB3141515 |
| 134 | + - ms-sharepoint2016-update-2017.02.21-KB3141517 |
| 135 | + - ms-sharepoint2016-update-2017.03.14-KB3178672 |
| 136 | + - ms-sharepoint2016-update-2017.03.14-KB3178675 |
| 137 | + - ms-sharepoint2016-update-2017.04.11-KB3178718 |
| 138 | + - ms-sharepoint2016-update-2017.04.11-KB3178721 |
| 139 | + - ms-sharepoint2016-update-2017.05.09-KB3191880 |
| 140 | + - ms-sharepoint2016-update-2017.05.09-KB3191884 |
| 141 | + - ms-sharepoint2016-update-2017.06.13-KB3203432 |
| 142 | + - ms-sharepoint2016-update-2017.06.13-KB3203433 |
| 143 | + - ms-sharepoint2016-update-2017.07.11-KB3213544 |
| 144 | + - ms-sharepoint2016-update-2017.07.11-KB3213543 |
| 145 | + - ms-sharepoint2016-update-2017.08.08-KB4011049 |
| 146 | + - ms-sharepoint2016-update-2017.08.08-KB4011053 |
| 147 | + - ms-sharepoint2016-update-2017.09.12-KB4011127 |
| 148 | + - ms-sharepoint2016-update-2017.09.12-KB4011112 |
| 149 | + - ms-sharepoint2016-update-2017.10.10-KB4011217 |
| 150 | + - ms-sharepoint2016-update-2017.10.10-KB4011161 |
| 151 | + - ms-sharepoint2016-update-2017.11.14-KB4011244 |
| 152 | + - ms-sharepoint2016-update-2017.11.14-KB4011243 |
| 153 | + - ms-sharepoint2016-update-2017.12.12-KB4011576 |
| 154 | + - ms-sharepoint2016-update-2017.12.12-KB4011578 |
| 155 | + - ms-sharepoint2016-update-2018.01.09-KB4011642 |
| 156 | + - ms-sharepoint2016-update-2018.01.09-KB4011645 |
| 157 | + - ms-sharepoint2016-update-2018.02.13-KB4011680 |
| 158 | + - ms-sharepoint2016-update-2018.03.13-KB4018293 |
| 159 | + - ms-sharepoint2016-update-2018.03.13-KB4011687 |
| 160 | + - ms-sharepoint2016-update-2018.04.10-KB4018336 |
| 161 | + - ms-sharepoint2016-update-2018.04.10-KB4018340 |
| 162 | + - ms-sharepoint2016-update-2018.05.08-KB4018381 |
| 163 | + - ms-sharepoint2016-update-2018.05.08-KB4018386 |
| 164 | + - ms-sharepoint2016-update-2018.06.12-KB4022173 |
| 165 | + - ms-sharepoint2016-update-2018.06.12-KB4022178 |
| 166 | + - ms-sharepoint2016-update-2018.07.10-KB4022228 |
| 167 | + - ms-sharepoint2016-update-2018.08.14-KB4032256 |
| 168 | + - ms-sharepoint2016-update-2018.08.14-KB4022231 |
| 169 | + - ms-sharepoint2016-update-2018.09.11-KB4092459 |
| 170 | + - ms-sharepoint2016-update-2018.10.09-KB4461447 |
| 171 | + - ms-sharepoint2016-update-2018.10.09-KB4092463 |
| 172 | + - ms-sharepoint2016-update-2018.11.13-KB4461501 |
| 173 | + - ms-sharepoint2016-update-2018.12.11-KB4461541 |
| 174 | + - ms-sharepoint2016-update-2019.01.08-KB4461598 |
| 175 | + - ms-sharepoint-designer-x32 |
| 176 | + - ms-sharepoint-designer-x64 |
| 177 | + - ms-sql-server2012-sp2 |
| 178 | + - ms-sql-server2014-sp2 |
| 179 | + - ms-sql-server2016-rtm |
| 180 | + - ms-sql-server-management-studio-17.04 |
| 181 | + - ms-visualstudio-2013.5.ent |
| 182 | + - ms-visualstudio-2013.4.ent |
| 183 | + - ms-visualstudio-2015.3.ent |
| 184 | + - ms-visualstudio-2015.2.ent |
| 185 | + - ms-visualstudio-2017.ent-installer |
| 186 | + - ms-visualstudio-2017.ent-dist-office-dev |
| 187 | + - ms-win2012r2-kb-dotnet46-KB3045557 |
| 188 | + - ms-win2012r2-kb-2014.03-KB2919442 |
| 189 | + - ms-win2012r2-kb-2014.04-KB2919355 |
| 190 | + - ms-win-2016-iso-x64-eval |
| 191 | + - ms-win2016-lcu-2018.05.17-KB4103720 |
| 192 | + - ms-win2016-lcu-2018.06.21-KB4284833 |
| 193 | + - ms-win2016-lcu-2018.06.12-KB4284880 |
| 194 | + - ms-win2016-lcu-2018.07.30-KB4346877 |
| 195 | + - ms-win2016-lcu-2018.07.24-KB4338822 |
| 196 | + - ms-win2016-lcu-2018.07.16-KB4345418 |
| 197 | + - ms-win2016-lcu-2018.07.16-KB4338814 |
| 198 | + - ms-win2016-lcu-2018.08.30-KB4343884 |
| 199 | + - ms-win2016-lcu-2018.08.14-KB4343887 |
| 200 | + - ms-win2016-lcu-2018.09.20-KB4457127 |
| 201 | + - ms-win2016-lcu-2018.09.11-KB4457131 |
| 202 | + - ms-win2016-lcu-2018.10.18-KB4462928 |
| 203 | + - ms-win2016-lcu-2018.10.09-KB4462917 |
| 204 | + - ms-win2016-lcu-2018.11.27-KB4467684 |
| 205 | + - ms-win2016-lcu-2018.11.13-KB4467691 |
| 206 | + - ms-win2016-lcu-2018.12.19-KB4483229 |
| 207 | + - ms-win2016-lcu-2018.12.11-KB4471321 |
| 208 | + - ms-win2016-lcu-2018.12.03-KB4478877 |
| 209 | + - ms-win2016-lcu-2019.01.17-KB4480977 |
| 210 | + - ms-win2016-lcu-2019.01.08-KB4480961 |
| 211 | + - ms-win2016-ssu-2018.05.17-KB4132216 |
| 212 | + - oracle-virtual-box-5.2.18-win |
| 213 | + - oracle-virtual-box-5.2.18-osx |
| 214 | + ``` |
| 215 | + |
| 216 | + |
| 217 | +#### Authoring custom file resources |
| 218 | +By default, `invoke-uplift` looks for `*.resource.json` files within its PowerShell module folder and two levels within the current directory on where it was run. These `*.resource.json` files are where file resources are defined. |
| 219 | + |
| 220 | +Such behaviour makes it easy to author project-specific file resources. `invoke-uplift` sees all resources defined within the current folder and two levels deep. |
| 221 | + |
| 222 | +For example, create `my-files.resource.json` file as follows: |
| 223 | + |
| 224 | +```js |
| 225 | +{ |
| 226 | + "resources": [ |
| 227 | + { |
| 228 | + "id": "my-7z-1805-x64", |
| 229 | + "uri": "https://www.7-zip.org/a/7z1805-x64.exe", |
| 230 | + |
| 231 | + "checksum": "C1E42D8B76A86EA1890AD080E69A04C75A5F2C0484BDCD838DC8FA908DD4A84C", |
| 232 | + "checksum_type": "SHA256", |
| 233 | + "metadata": { |
| 234 | + "help_link": "https://www.7-zip.org/download.html" |
| 235 | + } |
| 236 | + }, |
| 237 | + { |
| 238 | + "id": "my-7z-1805-x86", |
| 239 | + "uri": "https://www.7-zip.org/a/7z1805.exe", |
| 240 | + |
| 241 | + "checksum": "647A9A621162CD7A5008934A08E23FF7C1135D6F1261689FD954AA17D50F9729", |
| 242 | + "checksum_type": "SHA256", |
| 243 | + "metadata": { |
| 244 | + "help_link": "https://www.7-zip.org/download.html" |
| 245 | + } |
| 246 | + } |
| 247 | + ] |
| 248 | +} |
| 249 | +``` |
| 250 | + |
| 251 | +Once done, list and download resources as usual: |
| 252 | + |
| 253 | +```powerhell |
| 254 | +# list resources |
| 255 | +invoke-uplift resource list my- |
| 256 | +
|
| 257 | +# download resources |
| 258 | +invoke-uplift resource download my- -r c:/my-files-repository |
| 259 | +invoke-uplift resource download 7z-1805-x64 -repository c:/my-files-repository |
| 260 | +``` |
| 261 | + |
| 262 | +#### Forced file download |
| 263 | +By default, files are downloaded with checksum verification. Assuming that the first download was successful, consequent downloading won't download anything. That makes downloading experience fast. |
| 264 | + |
| 265 | +Sometimes we need to re-download files overriding existing ones. It can be done with `-f` or `-force` flag: |
| 266 | + |
| 267 | +```powerhell |
| 268 | +# list resources |
| 269 | +invoke-uplift resource list my- |
| 270 | +
|
| 271 | +# force download resources |
| 272 | +invoke-uplift resource download my- -r c:/my-files-repository -f |
| 273 | +invoke-uplift resource download 7z-1805-x64 -repository c:/my-files-repository -force |
| 274 | +``` |
| 275 | + |
| 276 | +#### Debug trace level |
| 277 | +By default, `invoke-uplift` reports only important information. Debug trace can be enabled with `-d` or `-debug` flag: |
| 278 | + |
| 279 | +```powerhell |
| 280 | +# list resources |
| 281 | +invoke-uplift resource list my -d |
| 282 | +
|
| 283 | +# force download resources |
| 284 | +invoke-uplift resource download my- -r c:/my-files-repository -f -d |
| 285 | +invoke-uplift resource download 7z-1805-x64 -repository c:/my-files-repository -force -d |
| 286 | +``` |
| 287 | + |
| 288 | +## Local development workflow |
| 289 | +Local development automation uses [Invoke-Build](https://github.com/nightroman/Invoke-Build) based tasks |
| 290 | + |
| 291 | +To get started, get the latest `dev` branch or fork the repo on the GitHub: |
| 292 | +```shell |
| 293 | +# get the source code |
| 294 | +git clone https://github.com/SubPointSolutions/subpointsolutions-docs.git |
| 295 | +cd subpointsolutions-docs |
| 296 | + |
| 297 | +# checkout the dev branch |
| 298 | +git checkout dev |
| 299 | + |
| 300 | +# make sure we are on dev branch |
| 301 | +git status |
| 302 | + |
| 303 | +# optionally, pull the latest |
| 304 | +git pull |
| 305 | +``` |
| 306 | + |
| 307 | +Local development experience consists of [Invoke-Build](https://github.com/nightroman/Invoke-Build) tasks. Two main files are `.build.ps1` and `.build-helpers.ps1`. Use the following tasks to get started and refer to `Invoke-Build` documentation for additional help. |
| 308 | + |
| 309 | +Change the current directory to the corresponding PowerShell module and run the following commands: |
| 310 | + |
| 311 | +```powershell |
| 312 | +# show available tasks |
| 313 | +invoke-build ? |
| 314 | +
|
| 315 | +# invoke default build |
| 316 | +invoke-build |
| 317 | +invoke-build DefaultBuild |
| 318 | +
|
| 319 | +# invoke QA automation |
| 320 | +invoke-build QA |
| 321 | +
|
| 322 | +# deploy/publish module |
| 323 | +invoke-build ReleaseModule |
| 324 | +``` |
| 325 | + |
| 326 | +## Feature requests, support and contributions |
| 327 | +All contributions are welcome. If you have an idea, create [a new GitHub issue](https://github.com/SubPointSolutions/uplift-powershell/issues). Feel free to edit existing content and make a PR for this as well. |
0 commit comments