33 lines
1.2 KiB
PowerShell
33 lines
1.2 KiB
PowerShell
|
|
Function Get-ViewerRemote($ComputerName){
|
|||
|
|
|
|||
|
|
if(!(Test-Connection -ComputerName $ComputerName -Count 1))
|
|||
|
|
{
|
|||
|
|
Write-Host "Exiting Viewer Remote...No connection made to [$ComputerName]" -ForegroundColor Red
|
|||
|
|
break
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$RemoteViewerPath = "C:\Program Files (x86)\ConfigMgr\bin\i386\CmRcViewer.exe"
|
|||
|
|
$RemoteViewerPathAdd = "C:\Program Files (x86)\ConfigMgr Console\bin\i386\CmRcViewer.exe"
|
|||
|
|
$RemoteViewerPathAdd2 = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"
|
|||
|
|
|
|||
|
|
if(Test-Path $RemoteViewerPath)
|
|||
|
|
{
|
|||
|
|
Write-Host "Attempting to remote into [$ComputerName]..." -ForegroundColor Green
|
|||
|
|
Start $RemoteViewerPath $ComputerName
|
|||
|
|
|
|||
|
|
}elseif(Test-Path $RemoteViewerPathAdd)
|
|||
|
|
{
|
|||
|
|
Write-Host "Attempting to remote into [$ComputerName]..." -ForegroundColor Green
|
|||
|
|
Start $RemoteViewerPathAdd $ComputerName
|
|||
|
|
|
|||
|
|
}elseif(Test-Path $RemoteViewerPathAdd2)
|
|||
|
|
{
|
|||
|
|
Write-Host "Attempting to remote into [$ComputerName]..." -ForegroundColor Green
|
|||
|
|
Start $RemoteViewerPathAdd2 $ComputerName
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
Write-Host "`nRemote Viewer Install Path Not Found...`nPlease install Config Manager Thick Client" -ForegroundColor Red
|
|||
|
|
}
|
|||
|
|
}
|