cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

Im trying to get a .cmd-script that pulls the serialnumber from the bios and outputs it in the chatwindow but I cant get it to work. code:

WMIC bios get serialnumber /format:list'

If I run the cmd on my computer it works fine but when I run it from rescue I get cryptic letters in chatwindow. What am I doing wrong?

 

While Im at it I can ask if there is a way to get the serial-information under the System Info tab in technician console?

 

 

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

Possibly stupid question - why .cmd instead of .bat?
Highlighted
Retired LogMeIn Contributor

Re: Rescue Script Repository Thread- Share your scripts

I know it's been a while, but try this instead (courtesy of members of our support and development team).

@echo off wmic SystemEnclosure GET SMBIOSAssetTag > tmp.txttype tmp.txt

 

What's happening is that the WMIC command outputs Unicode text as opposed to ASCII text (which the Tech console understands) the "type" command converts the Unicode to plain ASCII.

 

At this time the remote system serial number cannot be pulled into the System Info tab.

Rob H
LogMeIn Sales Engineer
Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

But what is the AML file?

 

 

 

 

Thank:)

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

Nevermore. If you need the AMLfile copy this to notepad

 

<scripts>
-
<script>
<name>SAMPLE - Defragment Status - C and D Drive</name>
-
<file>
C:\Logmein_Rescue_Scripts\Defrag_Info_Sample\defrag info Cdrive.cmd
</file>
<resource/>
<autoexec>false</autoexec>
</script>
-
<script>
<name>SAMPLE - Device Driver details</name>
-
<file>
C:\Logmein_Rescue_Scripts\Drivers_Details_Sample\driverdetails.cmd
</file>
<resource/>
<autoexec>false</autoexec>
</script>
-
<script>
-
<name>
SAMPLE - Software Deployment - Rescue AVI Converter
</name>
-
<file>
C:\Logmein_Rescue_Scripts\Install_Software_Sample\installAviConvert.cmd
</file>
-
<resource>
C:\Logmein_Rescue_Scripts\Install_Software_Sample\AVIConvert.msi
</resource>
<autoexec>false</autoexec>
</script>
-
<script>
<name>SAMPLE - MAC Address retrieval</name>
-
<file>
C:\Logmein_Rescue_Scripts\MAC_Info_Sample\getmacaddress.cmd
</file>
<resource/>
<autoexec>false</autoexec>
</script>
-
<script>
<name>SAMPLE - IP Config command</name>
-
<file>
C:\Logmein_Rescue_Scripts\One_Click_Ipconfig_Sample\startipconfig.cmd
</file>
<resource/>
<autoexec>false</autoexec>
</script>
</scripts>

 

When you save it, go to Save as Type and change it to All Files. Then name it Rescue Sample Scripts Definition.XML . Then you are done

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

A useful thing to do is redirect output from VBS scripts to the console window, i.e. so that instead of say a message box popping up on the screen of the machine to which you are connected you get the output on the chat window in LogMeIn (by redirecting output to the console). There are 2 simple steps:

1) Use a batch file to call the script using 'cscript', format:   cscript <VBscript name>

2) Add the VBscript file as a resource file

 

Example (OUTPUT A LIST OF PRINTERS):
1) Create a batch file called printer.bat which contains one line:

        cscript printer.vbs

2) Create a VBscript file called printer.vbs which contains the following (to enumerate printers):

 

Option Explicit
Dim objWMIService, objItem, colItems, strComputer, intPrinters
dim sOutput
strComputer ="."
intPrinters = 1

' --------------------------------------------
' Pure WMI Section
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")

'Call Wait() ' Goto Sub Routine at the end

' On Error Resume Next
For Each objItem In colItems
    sOutput = sOutput & vbCRLF & objItem.name
intPrinters = intPrinters + 1
Next
wscript.echo sOutput
sub Wait()
If strComputer = "." then
strComputer = "Local Host"
else strComputer = strComputer
end if

WScript.Echo "Wait 2 mins for " & strComputer _
& " to enumerate printers"

End Sub

WScript.Quit

 

3) Add the batch file as the script file and the VBscript file as the resource file.

4) When you DEPLOY you should get a list of the remote printers... 

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

Hi, I'm wondering if anyone has some examples of scripts for the Mac? Can we run commands in the Terminal? Applescript?

 

 

I want to script a reinstall of Java 1.5 which is removed during a Snow Leopard upgrade.

I want to know if it's possible to run these commands as a script

 

Step 1 Download a file eg 

www.cesoft.com.au/downloads/java/java5.zip 

Step 2 Run these commands in Terminal 

cd Downloads 
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard 
cd /System/Library/Frameworks/JavaVM.framework/Versions/ 
sudo rm 1.5.0 
sudo ln -s 1.5.0-leopard 1.5.0 
sudo chown -R root:wheel ./1.5.0-leopard 


They should be run in a terminal window, but there may be a way to do it with AppleScript. I hope you can give me some pointers. The user will need to enter a password for the first sudo command  

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

I've made some progress.

I can remotely execute simple commands such as 
cd ~/Downloads
ls -al

but when I need the users password, eg

sudo rm 1.5.0
I get the not entirely unexpected error
sudo: no tty present and no askpass program specified

Any tips on how to prompt the user for a password while running sudo?

Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

I know this thread's kind of old, but I'm working on some scripts of my own (might even post them here when I'm done) - I've noticed that the scripts run show results in the console, but I'm wondering if there's any way to get them to open and run the remainder of the cmd file in an actual command window. I'd like to do a menu of different options for working with a resource file, so I can't just transfer the menu as the resource because it already exists. Will running a "cmd.exe" from within the script open this up on the customer's computer or will it just be buggy and not run the script any farther (in my tests outside of LMI:R running cmd just lists a new command prompt but doesnt continue running the rest of the file until you type exit, something that isn't possible in the console.)

in other words, can the script file "sample.cmd" open a true cmd window and run the rest of the script from there?
Highlighted
New Contributor

Re: Rescue Script Repository Thread- Share your scripts

Sorry about the double post but I figured I should ask this while I thought of it.
Is there any way to get a cmd file script to show the info in the console as its running, not just showing the final output after its been run? I do have a couple scripts right now that run some pretty long processes, It'd be nice to see at least what step of the script it is on as its running, instead of just going on faith that its doing what its supposed to do.

Also, just so you know, I'm writing these scripts for use by many people in our organization, not just me, so as I work on these I'd like to make them as user-friendly as possible, even if the users are only my fellow techies.