Abyssmedia.com Forum Index Abyssmedia.com
Abyssmedia Support Forums
 
  FAQ    Search    Memberlist    Usergroups   Register 
  Profile    Log in to check your private messages    Log in 

Scripcryptor flashes briefly and fails to run script

 
Post new topic   Reply to topic    Abyssmedia.com Forum Index -> ScriptCryptor
View previous topic :: View next topic  
Author Message
msacademy



Joined: 09 Feb 2009
Posts: 3

PostPosted: Mon Feb 09, 2009 7:54 pm    Post subject: Scripcryptor flashes briefly and fails to run script Reply with quote

I am running a script that works fine in cscript and wscript. Is uses a:

strComputer = InputBox("What Is The Server Name To Query For Users?", "Windows Who Command")
If strcomputer = "" Or strcomputer = " " Then wscript.quit

to prompt for a value. But I briefly see a command box (but cannot read it) and the exe ends. But the prompt comes up fine in both script processors. Any ideas?

I do see this in the event log:

The description for Event ID ( 1904 ) in Source ( HHCTRL ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: http://www.abyssmedia.com/forum/posting,mode,newtopic,f,15.html, http://go.microsoft.com/fwlink?LinkID=45840.

But since I can run it with cscript and wscript, I don't see where a security issues exists. I have to assume it is the compiled exe.
Back to top
support
Site Admin


Joined: 13 Feb 2004
Posts: 378

PostPosted: Mon Feb 09, 2009 9:18 pm    Post subject: Reply with quote

What version of ScriptCryptor you have? Latest from this site work just find with you sample code.

Your event log points to the problem with HTML Help. You may find solution here: http://support.microsoft.com/kb/896358
Back to top
msacademy



Joined: 09 Feb 2009
Posts: 3

PostPosted: Mon Feb 09, 2009 9:27 pm    Post subject: Reply with quote

I am using the latest code because I just got the link from AbyssMedia today. Here is the complete script: (domain\administrator is the domain admin so that I can see computer info I am not authorized to with my individual user ID). Again, it works fine with cscript and wscript.

' Randy Schmidt
' January 2009
' this script will query any server for users logged on and display results in Notepad
Set WshShell = CreateObject("WScript.Shell")
' force cscript to run this even if launched from wscript so that logging will show

If InStr(1, WScript.FullName, "CScript", vbTextCompare) = 0 Then
WshShell.Run "cscript """ & WScript.ScriptFullName & """", 1, False
WScript.Quit
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
' delete our local copy of the file if it exists

If (objfso.FileExists("c:\whoisloggedon.txt")) Then
objfso.DeleteFile("c:\whoisloggedon.txt")
End If

' this is our output file which is nothing more than a copy of the input file but avoids locking the original file so it can updated by external processes
Const ForAppending = 8
Set objTextFileo = objFSO.OpenTextFile _
("c:\whoisloggedon.txt", ForAppending, True)

strComputer = InputBox("What Is The Server Name To Query For Users?", "Windows Who Command")
If strcomputer = "" Or strcomputer = " " Then wscript.quit

objTextFileo.WriteLine( "Here is Who Is Logged On To " & strComputer)
objTextFileo.WriteLine("=====================================================================")
objTextFileo.WriteLine(" ")
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer (strComputer, _
"root\cimv2", "domain\administrator", "secret")

Set colSessions = objSWbemServices.ExecQuery("Select * from Win32_LogonSession Where LogonType = 2 OR LogonType = 10")

If colSessions.Count = 0 Then
objTextFileo.WriteLine("No interactive users found")

Else

For Each objSession in colSessions

If objSession.LogonType = 2 Then
objTextFileo.WriteLine( "Logon type: Console")
Else
objTextFileo.WriteLine( "Logon type: RDP/Terminal Server")
End If

Set colList = objSWbemServices.ExecQuery("Associators of " _
& "{Win32_LogonSession.LogonId=" & objSession.LogonId & "} " _
& "Where AssocClass=Win32_LoggedOnUser Role=Dependent" )


For Each objItem in colList
objTextFileo.WriteLine( "User: " & objItem.Name)
objTextFileo.WriteLine( "FullName: " & objItem.FullName)
objTextFileo.WriteLine( "Domain: " & objItem.Domain)

Next

sessyear = Left(objsession.starttime,4)
sessmonth = Mid(objsession.starttime,5,2)
sessday = Mid(objsession.starttime,7,2)
sesshour = Mid(objsession.starttime,9,2)
sessmin = Mid(objsession.starttime,11,2)
sesssec = Mid(objsession.starttime,13,2)
sessionstart = sesshour & ":" & sessmin & ":" & sesssec & " on " & sessmonth & "/" & sessday & "/" & sessyear

objTextFileo.WriteLine( "Session start time: " & sessionstart)
objTextFileo.WriteLine(" ")
objTextFileo.WriteLine("=====================================================================")
ctr = ctr + 1
Next

objTextFileo.WriteLine(" ")
objTextFileo.WriteLine( "Total users logged on: " & ctr)

objTextFileo.WriteLine("=====================================================================")
End If

objTextFileo.Close

' now use Notepad to display the local output copy of the file
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "notepad c:\whoisloggedon.txt"
Back to top
support
Site Admin


Joined: 13 Feb 2004
Posts: 378

PostPosted: Tue Feb 10, 2009 9:48 pm    Post subject: Reply with quote

Problem solved via email.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Abyssmedia.com Forum Index -> ScriptCryptor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2011 phpBB Group