会社でエンドポイント サーバーをセットアップしようとしていますが、接続に苦労しています。
テストのために、関数をエクスポートするグローバル モジュール パス
C:\windows\system32\WindowsPowershell\v1.0\Modules\RcLogUtil\に RcLogUtil モジュールを配置しました。
'Out-LogToEventLog','New-LogMessage'
計画は、特定のユーザーのセットがそれらのログ機能のみにアクセスできるようにすることです。
SessionConfiguration を作成します。
New-PSSessionConfigurationFile -Path C:\Scripts\LoggerEp.pssc `
-SessionType RestrictedRemoteServer `
-LanguageMode FullLanguage `
-ExecutionPolicy Unrestricted `
-ModulesToImport 'RcLogUtil' `
-VisibleFunctions 'Out-LogToEventLog' `
-VisibleCmdlets 'Split-Path'
登録する:
Register-PSSessionConfiguration -Path C:\Scripts\LoggerEp.pssc `
-Name loggerep `
-ShowSecurityDescriptorUI
そしてそれを私のローカルマシンに入力してください:
[W0216]> Enter-PSSession -ComputerName mka-ps-endpoint -ConfigurationName loggerep
Enter-PSSession : この実行空間の作成に使用された InitialSessionState オブジェクトで指定されたモジュール 'RcLogUtil' の処理中に 1 つ以上のエラーが発生しました。エラーの完全なリストについては、ErrorRecords プロパティを参照してください。最初のエラー: 「Split-Path」という用語は、コマンドレット、関数、スクリプト ファイル、または操作可能なプログラムの名前として認識されません。名前のスペルを確認するか、パスが含まれている場合は、パスが正しいことを確認してから再試行してください。行:1 文字:1 + Enter-PSSession -ComputerName mka-ps-endpoint -ConfigurationName loggerep + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (:) [Enter-PSSession]、RunspaceOpenModuleLoadException + FullyQualifiedErrorId : ErrorLoadingModulesOnRunspaceOpen
大きな問題は、なぜセッションが分割パスを見つけられないのかということです。または、その特定のコマンドレットをロードするようにエンドポイントに指示するにはどうすればよいですか? 私は SessionType='Default' で同じことを試してみましたが、うまくいきましたが、その周りにすべてのパワーシェルが散らかっていました。
私はこれでかなり長い間立ち往生しているので、私が得ることができる助けを本当に感謝します..ありがとう!