Vor dem Import meines Powershell-Modul bearbeitet (MyModule.psm1)
, ich habe eine Funktion darin geschrieben:Powershell: eine bereits importierte Modul
Function T1()
{
Write-Host "T1 is just called" -ForegroundColor red
}
In meinem MyModule.psd1
:
@{
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '2.0'
# Name of the Windows PowerShell host required by this module
PowerShellHostName = ''
# Minimum version of the Windows PowerShell host required by this module
PowerShellHostVersion = '2.0'
# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @()
# Script files (.ps1) that are run in the caller's environment prior to importing this module
ScriptsToProcess = @()
# Modules to import as nested modules of the module specified in ModuleToProcess
NestedModules = @()
# Functions to export from this module
FunctionsToExport = '*'
# Cmdlets to export from this module
CmdletsToExport = '*'
# Variables to export from this module
VariablesToExport = '*'
# List of all modules packaged with this module
ModuleList = @()
# List of all files packaged with this module
FileList = @()
}
Diese feinen importiert wird, wenn ich kopiert beide Dateien in:
C:\Users\fwaheed\Documents\WindowsPowerShell\Modules\MyModule
und ich kann T1
in meiner Powershell-Sitzung ausführen.
Aber jetzt wollte ich eine neue Funktion in demselben Modul d.h .:
Function T2()
{
Write-Host "Its now T2.." -ForegroundColor red
}
Selbst hinzuzufügen, nachdem meine Powershell-Sitzung neu zu starten, ist es nie T2
zu erkennen, aber T1
arbeitet immer noch.
Wie kann ich meine bereits importierte Modul bearbeiten, so dass Änderungen sofort zur Verfügung stehen ...
Dank einem Haufen ...
'import-modul mymodule -force' ist nicht genug? –
Versucht, dass auch, aber vergeblich .. :( –
Danke Freund ... Nur das Modul entfernt, erneut importiert und mit versucht "Import-Modul MyModule-Force" Und es funktionierte durch Hinzufügen von 4 weitere Funktionen .. –