<h2>パターンで powershell スクリプトを実行する方法</h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><style type="text/css"><!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } </style> <div class="ns-kb-css-body-editor-container"> <p style="padding-left: 40px;">Powershell スクリプトは、必要に応じてパターンから実行できます。これにより、サーバー上で目的のスクリプトを柔軟に実行でき、データをフェッチしてパターンで使用できます。これは、必要な情報を CMDB に入力するためにも使用できます。</p> <span id="ns-kb-css-end-div-identifier" style="display: none; pointer-events: none;"></span></div></section></div><div ><h3 >Release</h3><section><style type="text/css"><!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } </style> <div class="ns-kb-css-body-editor-container"> <p style="padding-left: 40px;">すべてのバージョン</p> <span id="ns-kb-css-end-div-identifier" style="display: none; pointer-events: none;"></span></div></section></div><div ><h3 >Resolution</h3><section><style type="text/css"><!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } </style> <div class="ns-kb-css-body-editor-container"> <ol style="list-style-position: inside;"><li>次のようなコードを EVAL で使用して、PowerShell スクリプトを実行できます。</li></ol> <p style="padding-left: 80px;">EVAL(<br />def ip = com.snc.sw.context.support.net.IPUtils.getLocalIp();<br />def factory = new com.snc.sw.providers.DiscoveryProviderFactory();<br />def wmi =factory.create(com.snc.sw.dto.ProviderType.WMI, null);<br />wmi.setHost(ip);<br />return wmi.executeCommand("powershell.exe \"Get-module -ListAvailable\"");<br />)</p> <p style="padding-left: 80px;"><img style="border: 1px solid black; align: baseline;" src="sys_attachment.do?sys_id=f5e57c0ddb8478d0fec4fb24399619e8" width="835" height="374" align="baseline" border="1" /></p> <p style="padding-left: 40px;">2.それ以外の方法は、操作から「コマンド」を選択し、次のようにPowerShellコマンドを直接提供することです。</p> <p style="padding-left: 80px;">Example 1: Powershell \" get-process | get-member \"<br />Example 2: Powershell \" Get-ChildItem Cert:\ -Recurse -Force | Select-Object -Property Thumbprint,FriendlyName \"</p> <span id="ns-kb-css-end-div-identifier" style="display: none; pointer-events: none;"></span></div></section></div></article></div>