以下のスクリプトを参照してください 実行ポリシーを無制限に設定し、スクリプトの最後に戻すには、スクリプト内に管理者権限を組み込んだ状態でこのスクリプトを起動する必要があります。これまで私が見つけたことから、これは不可能であるか、非常に困難です。私はこれを行う簡単な方法があると思っています。このスクリプトを実行するユーザーは、PC上で管理者権限を持たないため、PowerShellの内部から昇格したり手動で実行することはできません。資格はプレーンテキストで表示されます:実行権限を持つスクリプトを実行して実行ポリシーを変更する方法
$GBL_Username = "Here type your username"
$GBL_Password = ConvertTo-SecureString –String "Here type your password in plain text" –AsPlainText -Force
$GBL_Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $GBL_Username, $GBL_Password
Start-Process 'C:\Program Files (x86)\Microsoft Office\office15\lync.exe' -Credential $GBL_Credential
をそして第二部(オフィスComunicatorの実行)これで
問題で変数$GBL_Credential
を使用します。
Stop-process -Name OUTLOOK -ErrorAction SilentlyContinue -Force
Stop-process -Name communicator -ErrorAction SilentlyContinue -Force
Stop-process -Name lync -ErrorAction SilentlyContinue -Force
Stop-Process -Name UcMapi -ErrorAction SilentlyContinue -Force
Stop-Process -Name skypehost -ErrorAction SilentlyContinue -Force
Stop-Process -Name searchprotocolhost -ErrorAction SilentlyContinue -Force
$OstPath = "c:\users\$([environment]::username)"+ "\AppData" + "\local" + "\Microsoft" + "\Outlook"
$ost = get-ChildItem $OstPath | where { $_.Extension -eq ".ost"}
$ost | remove-Item -force
Start-Process Outlook
if (Test-Path 'C:\Program Files (x86)\Microsoft Office\office15\lync.exe')
{
Start-Process 'C:\Program Files (x86)\Microsoft Office\office15\lync.exe'
}
Else
{
write-host "Lync is not installed"
if (Test-Path 'C:\Program Files (x86)\Microsoft Office Communicator')
{
Start-Process 'C:\Program Files (x86)\Microsoft Office Communicator\communicator.exe'
}
Else
{
write-host "Communicator is not installed"
}
}
私はこの回答を次のようにして開始したいと思います: 'あなたは何をしているのですか、これをしないでください:' –