Unable to load VI-Module due to a number of errors
mjpcomp opened this issue · comments
Receive the following errors when attempting to load the Vi-Module:
`At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:2956 char:4
-
{
-
~
Missing closing '}' in statement block or type definition.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:2950 char:3
-
{
-
~
Missing closing '}' in statement block or type definition.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:2849 char:2
-
{
-
~
Missing closing '}' in statement block or type definition.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:2775 char:1
- {
- ~
Missing closing '}' in statement block or type definition.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:3085 char:155 - ... und(((Get-Date) – ($_.LastActiveTime).ToLocalTime()).TotalMinutes))
-
~
Unexpected token ')' in expression or statement.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:3101 char:3
-
}
-
~
Unexpected token '}' in expression or statement.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:3103 char:2
-
}
-
~
Unexpected token '}' in expression or statement.
At C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\Vi-Module.psm1:3105 char:1
- } #EndFunction Get-ViSession
- ~
Unexpected token '}' in expression or statement.- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : MissingEndCurlyBrace
Import-Module : The module to process 'Vi-Module', listed in field 'ModuleToProcess/RootModule' of module manifest
'C:\Users\usernamehere\Documents\WindowsPowerShell\Modules\vi-module\vi-module.psd1' was not processed because no
valid module was found in any module directory.
At line:1 char:1
- Import-Module vi-module -verbose
-
+ CategoryInfo : ResourceUnavailable: (vi-module:String) [Import-Module], PSInvalidOperationException + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
`
Thanks, I had originally downloaded, and then did a copy/paste of the RAW code with no luck.. I ended up breaking out every function into a separate file, and loading them with the module definition file...
Then, when I ran, I was able to pinpoint it back to:
Expand-VMGuestPartition
So, I copied and pasted just that function into my broken out files...
I found that in Vi-Module.psm1 there was a ANSI character – that is displayed as - in UTF-8 encoding in 3 places. Once I replaced – with - it worked as expected.
Hello,
i tried all your suggestions (copy and paste, download as zip, change the caracther) but still i get the errors.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:3000 car:4
-
{
-
~
'}' di chiusura mancante nel blocco di istruzioni o nella definizione del tipo.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:2994 car:3
-
{
-
~
'}' di chiusura mancante nel blocco di istruzioni o nella definizione del tipo.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:2893 car:2
-
{
-
~
'}' di chiusura mancante nel blocco di istruzioni o nella definizione del tipo.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:2819 car:1
- {
- ~
'}' di chiusura mancante nel blocco di istruzioni o nella definizione del tipo.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:3129 car:155 - ... und(((Get-Date) – ($_.LastActiveTime).ToLocalTime()).TotalMinutes))
-
~
Token ')' imprevisto nell'espressione o nell'istruzione.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:3145 car:3
-
}
-
~
Token '}' imprevisto nell'espressione o nell'istruzione.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:3147 car:2
-
}
-
~
Token '}' imprevisto nell'espressione o nell'istruzione.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:3149 car:1
- } #EndFunction Get-ViSession
- ~
Token '}' imprevisto nell'espressione o nell'istruzione.
In C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psm1:41 car:30 -
[pscustomobject[]] GetVlan ([ValidateRange(1, 4094)][int[]]$VlanI ...
-
~~~~~~~~~~~~~~~~~~~~~~~~
Attributo 'ValidateRange' non valido in questa dichiarazione. È valido solo nelle dichiarazioni 'Property, Field'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace
Import-Module : Impossibile elaborare il modulo 'Vi-Module' elencato nel campo 'ModuleToProcess/RootModule' del
manifesto del modulo 'C:\Users\ftremamunno\Documents\WindowsPowerShell\Modules\Vi-Module\Vi-Module.psd1'. Non sono
stati trovati moduli validi in alcuna directory di moduli.
In riga:1 car:1
- Import-Module Vi-Module -Force -Verbose
-
+ CategoryInfo : ResourceUnavailable: (Vi-Module:String) [Import-Module], PSInvalidOperationException + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
The reason is your enterprise proxy or antivirus software.
Try to download outside your organization.
Just want to add a comment that I had similar issues loading the module on 5/24/2018. I had downloaded it as a ZIP. Based on the comments above I used notepad ++, search, find characters in range, non-ascii, copy the line(s) out to a cmd window to get rid of the characters, went back to the vi-module.psm1 and delete the line affected as well as above and below to make sure I go the char, copied it back in from the cmd box and saved. That worked for me. Not sure why A/V or proxy would be causing this but this work around fixed it. Thanks for making this very helpful module!! :)