2013-03-13 2 views
0

다양한 기능을 가진 모듈이 있습니다. 나는 최근에 기능을 추가했다. 이 함수는 매개 변수를 받아들이고 일부 데이터를 처리하며 그 안에있는 다른 함수를 호출합니다. 이 함수는 문자열 배열을 매개 변수로 사용합니다. 다음은PowerShell 2.0에서 매개 변수가 필요한 함수 내에서 함수 호출

 Function Get-CMClientInstall{ 
     some code.......... 

     Analyze-ClientInstall $clientcheck 


     Function Analyze-ClientInstall 
     { 
      #[CmdletBinding()] 

      PARAM (
      [Parameter(Mandatory=$true)][string[]]$CCMClients) 
     } 
    } 

오류 메시지입니다 :

The term 'Analyze-ClientInstall' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ConfigMgrCommands\ConfigMgrCommands.psm1:475 char:34 
+    Analyze-ClientInstall <<<< $clientcheck 
    + CategoryInfo   : ObjectNotFound: (Analyze-ClientInstall:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException 

누군가가 조언을 주시겠습니까 아래 코드는? 미리 감사드립니다.

답변

1

PowerShell은 파일을 읽고 동 기적으로 콘텐츠를 실행합니다. PowerShell 함수를 호출 할 때 PowerShell은 아직 해석하지 않았기 때문에 존재한다는 단서가 없습니다. 함수 선언 후 함수로 호출하도록 이동합니다.

Function Get-CMClientInstall{ 
    some code.......... 


    Function Analyze-ClientInstall 
    { 
     #[CmdletBinding()] 

     PARAM (
     [Parameter(Mandatory=$true)][string[]]$CCMClients) 
    } 


    Analyze-ClientInstall $clientcheck 
} 
+0

감사합니다. – Rajiv