Get-PC/Private/ViewerRemote.ps1
Zachary Gorman 4a01da0e5d Init commit
2024-06-11 11:27:55 -07:00

34 lines
1.3 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
}
$SiteName = "100"
$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
}
}