Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Oh soooo close....

Featured Replies

Hey all,

I am developing a very simple deployment solution. It works well but I'm having some trouble with the return/error codes. When I put a fictitious target computer name in tst.txt, it will return either 0, 53, or 9009 (due to DNS issues on our network). It will return a 0 when it has executed successfully on a real target computer. Here's the source below:

@echo off
echo ********************** >>errors.txt
date /t >>errors.txt
time /t >>errors.txt
echo ---------------------- >>errors.txt
cls
for /f %%a in (tst.txt) DO (
echo Executing on %%a
echo ======================
PSEXEC %%a -c "C:\deployment tool\dummy.bat" dummy.bat
echo %%a reported errorlevel: %errorlevel% >> errors.txt
echo ======================
echo %errorlevel%
pause )

It reads the names of target machines from tst.txt. Dummy.bat is the script that is to be run on the target machines. And error.txt is of course where the errorlevel is supposed to be recorded.

I know that there would be a fair amount of interest in a system like this and hope that we can get this up and running.

Thanks in advance!

Edited by robotnik

Try this...

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET TARGETFILE=%~dp0targets.txt
SET LOG=%~dpn0.log

IF EXIST "!LOG!" DEL /Q "!LOG!"
CALL :TEE %DATE: =0%, %TIME: =0%
CALL :TEE ~~~~~~~~~~~~~~~~~~~~~~~
IF EXIST "%TARGETFILE%" FOR /F "tokens=*" %%C IN ('type "%TARGETFILE%"') DO (
IF "%%~C"=="" GOTO :EOF
SET COMMAND=PSEXEC %%~C -c "C:\deployment tool\dummy.bat" dummy.bat
CALL :TEE running !COMMAND!
CALL !COMMAND!
IF NOT !ERRORLEVEL! EQU 0 (
CALL :TEE %%C reported errorlevel: !ERRORLEVEL!
)
CALL :TEE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)
PAUSE
GOTO :EOF

:TEE
ECHO %*
ECHO %* 2>&1 1>>"%LOG%"
GOTO :EOF

Al

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.