![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Re: Remove-Module Cmdlet Bug Thanks for confirming the behavior Jon. I also tried commenting the Export-ModuleMember line in the PSM1 to add the full module from the script like: Add-Module Count # adding just the *-Count functions Add-Module Count *-count Add-Module Count get-count, reset-count # ...and removing the module like this: Get-Module Count | Remove-Module Same result, Get-Module doesn't find it but the functions remain. -- Kiron |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Remove-Module Cmdlet Bug Yeah that's weird. Also seems to continue working with the visible functions deleted ... #Add the module Add-Module count -verbose $m = Get-Module count & $m {Get-Count} & $m {Get-Count} Get-Count Get-Count #Remove the module Remove-Module count #Remove the exported functions too ... Remove-Item Function:Get-Count Remove-Item Function:Reset-Count Get-module #No modules listed #Still functioning & $m {Get-Count} & $m {Get-Count} -- Jon |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Remove-Module Cmdlet Bug Isn't $m another PSModuleInfo instance? That would explain why calling a member of the module works. & $m {Get-Count} -- Kiron |
My System Specs![]() |
| | #4 (permalink) | ||||||||||||
| Guest | Re: Remove-Module Cmdlet Bug "Kiron" <Kiron@xxxxxx> wrote in message news:C70B2015-9293-4131-9AD6-12C94E2DE8F2@xxxxxx
It's probably something along those lines, although it's odd that both approaches update the same $count eg in the sequence #-------------------- Add-Module count $m = Get-Module count get-count & $m {Get-Count} get-count & $m {Get-Count} get-count #-------------------- Difficult to get a clear picture of precisely what's supposed to happen in the current absence of any decent documentation for the cmdlets or a substantial blog entry.... any takers? -- Jon | ||||||||||||
My System Specs![]() | |||||||||||||
| | #5 (permalink) |
| Guest | Re: Remove-Module Cmdlet Bug Right, all assignments --PSModuleInfo objects-- to the Module behave as a Reference to it. # fix bug in Count.psm1's Get-Count to use the Module's $increment function Get-Count { return $script:count += $increment } &{ add-module Count $m1 = $m2 = get-module Count $m3 = get-module Count &$m1 {setIncrement 8} &$m2 {count} &$m3 {count} count remove-module Count &$m2 {setIncrement 21} &$m3 {count} &$m1 {count} try {count} catch {write-host Module gone from local scope} ls Function:*-Count | ri # effective way to remove from local scope try {count} catch {write-host Module gone from local scope...} &$m3 {setIncrement -3} &$m1 {count} &$m2 {count} $m1.isCompiledCode $m2.isCompiledCode $m3.isCompiledCode } -- Kiron |
My System Specs![]() |
| | #6 (permalink) | ||||||||||||
| Guest | Re: Remove-Module Cmdlet Bug Yep, that helps to get a better feel for what's going on. Thanks Kiron. -- Jon "Kiron" <Kiron@xxxxxx> wrote in message news:8A244F88-180E-45EC-AA07-2824201FCD2D@xxxxxx
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #7 (permalink) |
| Guest | Re: Remove-Module Cmdlet Bug Thank you too Jon. -- Kiron |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Invoking Cmdlet Get-Location from cmdlet,cant get Currnt Directory | Vikram | PowerShell | 2 | 06-05-2008 04:41 AM |
| Re: CTP2: Remove-Module Cmdlet Bug | Kiron | PowerShell | 1 | 05-15-2008 08:42 PM |
| Whether a cmdlet derives from cmdlet or pscmdlet | Marco Shaw | PowerShell | 1 | 09-19-2007 09:18 PM |
| Invoking a cmdlet from another cmdlet | Marco Shaw | PowerShell | 2 | 09-19-2007 12:46 PM |
| Invoke Cmdlet from a Cmdlet | =?Utf-8?B?ZnV6enkzMzM=?= | PowerShell | 3 | 08-25-2006 07:49 AM |