PowerShellCrack / PowerCLI-ModuleInstaller

Installs the latest PowerCLI tools Offline and online
http://www.powershellcrack.com/2017/09/installing-powercli-on-disconnected.html
7 stars 0 forks source link

.dll copy succeeds but still requests NuGet provider required to continue #1

Open graffVCP opened 5 years ago

graffVCP commented 5 years ago

downloaded and extracted the .210 dll file successfully from https://www.powershellgallery.com/packages/PackageManagement/1.1.7.2 Placed into the working directory per instructions.... NuGet --2.8.5.210 ----Microsoft.PackageManagement.NuGetProvider.dll

Script navigates to the Modules\VMware.PowerCLI-11.0.0-10380590 successfully and that that is when it states it still needs "NuGet provider is required to continue" "PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories..."

I went above and beyond the script by placing the Microsoft.PackageManagement.NuGetProvider.dll in the c:\Program Files\PackageManagement\ProviderAssemblies\nuget and c:\users\%userprofile%\AppData\Local\PackageManagement\ProviderAssemblies\NuGet directories and verified the script placed the .dll into the c:\Program Files (x86)\PackageManagement\ProviderAssemblies\

What is continuing to trigger the NuGet?

I've downloaded and tried different VMware.PowerCLI Modules version from both the PowerShellGallery and from https://code.vmware.com/web/dp/tool/vmware-powercli sites.

I saw the https://blogs.vmware.com/PowerCLI/ mentions under known issuese suggesting getting something newer than the standard "Older versions of PowerShellGet (Example: 1.0.0.1) will fail because it can’t handle the formatting of one specific PowerCLI version."

What version have you tested for PowerShellGet? I'll have to try that tomorrow since I"ve been trying this all day to work :(

PowerShellCrack commented 5 years ago

Right click the nuget dll file and got to properties. In the bottom right windows does it say to unblock the file?

On Mon, Feb 11, 2019, 4:57 PM graffVCP <notifications@github.com wrote:

downloaded and extracted the .210 dll file successfully from https://www.powershellgallery.com/packages/PackageManagement/1.1.7.2 Placed into the working directory per instructions.... NuGet --2.8.5.210 ----Microsoft.PackageManagement.NuGetProvider.dll

Script navigates to the Modules\VMware.PowerCLI-11.0.0-10380590 successfully and that that is when it states it still needs "NuGet provider is required to continue" "PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories..."

I went above and beyond the script by placing the Microsoft.PackageManagement.NuGetProvider.dll in the c:\Program Files\PackageManagement\ProviderAssemblies\nuget and c:\users%userprofile%\AppData\Local\PackageManagement\ProviderAssemblies\NuGet directories and verified the script placed the .dll into the c:\Program Files (x86)\PackageManagement\ProviderAssemblies\

What is continuing to trigger the NuGet?

I've downloaded and tried different VMware.PowerCLI Modules version from both the PowerShellGallery and from https://code.vmware.com/web/dp/tool/vmware-powercli sites.

I saw the https://blogs.vmware.com/PowerCLI/ mentions under known issuese suggesting getting something newer than the standard "Older versions of PowerShellGet (Example: 1.0.0.1) will fail because it can’t handle the formatting of one specific PowerCLI version."

What version have you tested for PowerShellGet? I'll have to try that tomorrow since I"ve been trying this all day to work :(

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PowerShellCrack/PowerCLI-ModuleInstaller/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ATpUETcffn5yeYU9q8JN2S1v8_2nhF6Kks5vMedMgaJpZM4a1JG2 .

PowerShellCrack commented 5 years ago

Try running Unblock-File on the nuget dll

graffVCP commented 5 years ago

I unblocked the .dll in all 4 locations it was placed. It seemed to move the ball forward resulting in a new error. While executing the "installing VMware PowerCLI (11.0.0) to C:\Program Files (x86\windowsPowerShell\Modules\VMware.PowerCLI the following red out put error occurs:

"PackageManagement\Install-Package | No match was found fro the specified search criteria and module name 'VMware.PowerCLI'. Try Get-PSRepository to see all available registered module repositories. At C:\Program Files\WindowsPowerShell\Modules\PowerShelllGet\1.0.0.1\PSModule.psm1:1809 char21

Executing Get-PSRepository as it suggests results in: WARNING: Unable to find module repositories

is there a need for the nuget.exe to create/publish a local repository would be useful? What version of PowerShellGet was this tested on? What version of PowerShell was this tested on?

PowerShellCrack commented 5 years ago

Ok i see the problem. when I rewrote it I had stored the Powercli locally and it would work fine for me, but newer or older ones failed. The stupid thing about Microsoft's PowerShell modules is when you run a Save-Module on an internet connected device, then move that module to a disconnected device, it doesn;t meet the module requirements (\*.psm1). But if you place the missed formatted module you just downloaded in one of PowerShells paths and run Install-Module against that folder, it will "extract" it in the proper folders. Not sure if this is by design ,but it screws with offline installs. Also VMware says that they don't support multiple versions of PowerCli to be installed at together, so I added in the script to check all loaded module locations for PowerCLI and their dependencies and removed them. I also added a module version checker to ensure only the latest version is installed, incase you download a later version and forget to remove the old version. Please let me know if this solves the problem

graffVCP commented 5 years ago

I will give it a try today. I manually downloaded the PowerCLI from the VMware code site & renamed subbing the extra two dashes for dots. I have already manually deleted all prior VMware-PowerCLI modules in the 3 various potential areas and uninstalled the old 6.5r1 from programs & features.

The "how to use" newer readme.md looks a lot better but still overlooks the part about downloading the PackageManagement in order to extract the necessary Microsoft.PackageManagement.NuGetProvider.dll file to place in the NuGet folder. The version I grabbed is 2.8.5.210 and not the 2.8.5.208 version folder you have pre-staged. The file also has been unblocked in the properties as well :)

graffVCP commented 5 years ago

copiedbutfailstoinstall-package outputlogattemptsinstall-package_fromnulldirectory_nottrulycopied

Still fails....log output shows it thinks it copied the latest VMware PowerCLI to C:\Program Fils (x86)\WindowsPowerShell\Modules\VMware.PowerCLI but browsing to that directory shows there is no folder contents of that nature that was copied over yet the script continues to attempt to install from that copied location so there's no integrity check to ensure that directory or the "VMware.PowerCLI.psd1 actually exists.

Are you in GAL? I have two screenshots to share here with redacted user info from path.

{EDIT} I reviewed your script more in depth. you had a typo of SkopePath which i corrected to ScopePath. Re-ran script which reduced the errors but still ended in a failure to install.

However, I now get a directory VMware.PowerCLI-stage that creates itself...but during that "Installing VMWare PowerCLI (VERSION) to C:\Program Files (x86)\WindowsPowerShell\Modules\VMware.PowerCLI it errors out with the "Failed to Install VMware PowerCLI Module (VERSION). It leaves the -stage folder when it errored out at the PowerShell Admin prompt {EDIT2} Realized there was more than one "SkopePath" to replace so replaced ALL for "ScopePath" -saved revised Install-PowerCLI.ps1 -Deleted the VMware.PowerCLI-stage folder -re-ran the installer....copies files over w/progress bar then during the next "Installing VMWare PowerCLI version to VMware.Power PowerShell errors out with... "PackageManagement\Install-Package No match was found for the specified search criteria and module name 'VMware.PowerCLI'. Try Get-PSRepository to see all available registered module repository -script successfully removed the -stage folder but no new modules have been created anywhere for VMware.PowerCLI

PS >Get-PSRepository Outputs "WARNING: unable to find module repositories"

PowerShellCrack commented 5 years ago

curious when you pulled this repo. It should "stage" the module in a folder named something like: "Vmware.PowerCli-stage" and in my source don't see the $skopepath mistake nor the errors in writing logs. I just updated the version (3.1.0001) and commit it.

PowerShellCrack commented 5 years ago

i loaded a brand new OS on a disconnected network and copied the script over and I'm seeing the same issue....down the rabbit hole I go,....

graffVCP commented 5 years ago

what's so frustrating is that I can just copy the VMware.PowerCLI modules manually to any of the valid paths in $PSModulePath and the Get-Module VMware* -Listavailable will display all of the VMware modules.

Just to change it up I opened an Administrator Windows PowerShell ISE. See all the VMware Modules... When i click on the "Connect-VIserver' or try to use the command it says I need "to import the "VMwareVIMAutomation.Core" module and its cmdlets including "Connect-VIServer"

They keep outputting error message "The specified module 'VMwareVIMAutomation.Core' was no loaded because no valid module file was found in any module directory...sigh. It appears that I cannot get around the need to Publish some type of Local Module repository.

graffVCP commented 5 years ago

the version GitHub has is the v2 branch & the screenshot shows 'SkopePath' and its repeated further into the script as well. It is not showing a new commit of files since yesterday.

branch master shows 11months ago last updated branch v2 shows 19hours ago & 3hours agove for the Install-PowerCLI.ps1 which still has the 'SkopePath' v2_skopepath_20190213

PowerShellCrack commented 5 years ago

Ok try the newly updated one.

PowerShellCrack commented 5 years ago

Sorry about all the problems. I dug further into the Install-Module PowerShell script and found it will only install modules from a repository or online and always tries to pull down nuget. As long as the powercli modules are formatted correctly (\\). then just copying them to the location and running import-Module (not Install-Module) works just fine. If you download the module from VMware as a zip it is not formatted properly. Use the save-Module command or my get-PowerCLI.ps1

graffVCP commented 5 years ago

i am a bit confused by your comment. When I have copied over the unzipped download from the VMware code I have followed the format you outlined in your script by renaming the two dashes as periods...are you saying I need to revert back to VMware's formatted name with three dashes or strip the version off completely?

Download VMware.PowerCLI Module from: https://code.vmware.com/web/dp/tool/vmware-powercli/11.1.0

downloaded your latest github commit. Upon evaluating I attempted to just do the Import-Module statement that was in the script but it continues to fail stating it needs the VMware.VimAutomation.SDk that it cannot find in any modules. I'll run through your script again and purge any Modules I manually copied over....1st run of the install-PowerCLI.ps1 errors out during the (32-Bit) shortcut section....looks like it is a bad reference for the icon and link files.
--EDIT: did you mean to strip out the Staging portion from the Install Section in the latest commit? I see the robocopy section has been scrapped and overhauled. I'm getting syntax errors for string failing to terminate and closing }. ~Possibly appears the last 4 lines were dropped off from your .ps1 installer.....for Exit } Else{Import-Module $ModuleName }

I'm comparing the 2/12 versus 2/13

PowerShellCrack commented 5 years ago

Let me explain it better. VMWare's download is not formatted prop

graffVCP commented 5 years ago

not sure what happened to your comment being cut off and closed prematurely...but I got it working on my system today.

The missing "piece" of the puzzle what that I need to copy all the MODULES Folders into the MODULES

instead of copying the VMware.PowerCLI or VMware.PowerCLI- parent folder into the Destination Path MODULES.. the fix was that I copied the CONTENTS of VMware.PowerCLI- child sub-folders (VMware.DeployAutomation, VMware.PowerCLI, VMware.Vim, VMware.VIMAutomation.*, etc. into the MODULES Destination Path

Secondly....I think the section of your script for #Get all paths to PowerShell Modules could be improved and the ShortcutSection may need some touch-ups. I've got to leave for the today but I'll try to be more specific.

PowerShellCrack commented 5 years ago

Nice. At least u got it working. I'm revamping my entire script. I see lots of flaws...

On Fri, Feb 15, 2019, 2:46 PM graffVCP <notifications@github.com wrote:

not sure what happened to your comment being cut off and closed prematurely...but I got it working on my system today.

The missing "piece" of the puzzle what that I need to copy all the MODULES Folders into the MODULES

instead of copying the VMware.PowerCLI or VMware.PowerCLI- parent folder into the Destination Path MODULES.. the fix was that I copied the CONTENTS of VMware.PowerCLI- child sub-folders (VMware.DeployAutomation, VMware.PowerCLI, VMware.Vim, VMware.VIMAutomation.*, etc. into the MODULES Destination Path

Secondly....I think the section of your script for #Get all paths to PowerShell Modules could be improved and the ShortcutSection may need some touch-ups. I've got to leave for the today but I'll try to be more specific.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/PowerShellCrack/PowerCLI-ModuleInstaller/issues/1#issuecomment-464176138, or mute the thread https://github.com/notifications/unsubscribe-auth/ATpUEbgAPxj4iDwjbRKjSwbnwX9K7IF8ks5vNw6XgaJpZM4a1JG2 .