Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:38:05+00:00 2026-06-12T04:38:05+00:00

I am trying to install an application and a group of services using PSTools,

  • 0

I am trying to install an application and a group of services using PSTools, but I want to take into account that the computer I am trying to connect to may be turned off or on a different network, which is not reachable from the internal network.

Basically if the machine is not able to be accessed through the admin share, this is the message that I am getting:

Couldn’t access MachineName:
The network path was not found.
Make sure that the default admin$ share is enabled on MachineName.

This is the syntax I am using to try to capture the “Error Message” and then report back that if installation was successful or not (depending on if it can contact the machine)

@echo off
set /p name=What is the machine name?: 
psexec.exe \\%name% -u *useraccount* -p *password* \\ServerName\installation.bat
FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Couldn't access"') DO SET Error=%%A
If "%Error%"=="Couldn't access" 
ECHO Installation Failed.
Else
ECHO Installtion complete.  
Pause
exit

Currently it hangs right at the point it’s defining the Error Variable. Can’t quite figure out what I am going wrong here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:38:06+00:00Added an answer on June 12, 2026 at 4:38 am

    'COMMAND ^| FIND "Couldn't access"' opens a command shell, which is why it hangs. It will not proceed until that shell is exited.

    You will need to look at redirecting the error messages to another file. 2>Errors.txt on the psexec line will give you a file to search in the next line.

    this will make the batch file look something like this:

    @echo off
    set /p name=What is the machine name?: 
    psexec.exe \\\%name% ... \\\ServerName\installation.bat 1>Error.txt 2>&1 
    for /f "tokens=*" %%A in ('FIND /i error.txt "Couldn't Access"') do SET Error=%%A
    If not x%ERROR:Couldn=%==x%ERROR% (
    ECHO Installation Failed.
    ) Else (
    ECHO Installtion complete.  
    )
    Pause
    exit
    

    (Also, notice the use of brackets to make a multi line IF)
    the check for if will see if Couldn is part of the string, as a direct comparison will not work, as you would have to check against the whole string including the machine name

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to debug a memory leak in a Node.js application but cannot install
I am trying to install my own android application on SDcard using windows platform.
I'm trying to install the application node , but by default in my environment
The Orchardcms Application works fine accept when trying to Install new modules using the
I'm looking and trying to install my console application as service but not figured
I am trying to install a simple java application as a windows service using
I m trying to install Glassfish Application Server 3.1. But I get this I
I'm trying to install an application using a VS Setup project for .NET 1.1
We are trying to pre-install a NDK Application into the /system/app directory. If I
I'm trying to install a PHP application on my server. But I'm getting this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.