leighlandwhitehead Posted November 4, 2014 Share Posted November 4, 2014 Hi guys , i am using the ObjCreate function with the server name , username and password parameters so i can call windows updates on a remote machine. i am having a problem with connecting to the remote PC , which has remote registry enabled and also the file and printer sharing is turned on. i am currently testing with the example script (windows media player) that comes with the installer and i am having the same issue here (code below). #include <MsgBoxConstants.au3> ; AutoItCOM 3.1.1 ; ; Test file ; ; Test usage of creating objects on a remote computer ; ; Notes: ; ; - The remote Object must have DCOM (Distributed COM) functionality. ; - The remote computer must have 'Remote Registry Service' and 'File and Printersharing' turned on! ; ; To check for any DCOM-Enabled Objects, use DCOMCNFG.EXE (=Component Services MMC) on the remote computer. Local $sRemoteComputer = "leighlandwtest-" ; Change this to your remote computer name Local $sRemoteUsername = "leighlandwtest-leighland" ; Change this to your username on the remote computer Local $sRemotePassword = "test" ; Change this to your password on the remote computer ; First install our own Error Handler Global $g_nCOMError = 0, $g_oErrObj = ObjEvent("AutoIt.Error", "MyErrFunc") ; Open MediaPlayer on a remote computer Local $oRemoteMedia = ObjCreate("MediaPlayer.MediaPlayer.1", $sRemoteComputer, $sRemoteUsername, $sRemotePassword) If @error Then MsgBox($MB_SYSTEMMODAL, "Remote ObjCreate Test", "Failed to open remote Object. Error code: " & Hex(@error, 8)) Exit EndIf MsgBox($MB_SYSTEMMODAL, "Remote Test", "ObjCreate() of a remote object successfull !") Local $iEnabled = $oRemoteMedia.IsSoundCardEnabled If Not @error Then MsgBox($MB_SYSTEMMODAL, "Remote Test", "Invoking a method on a remote Object successfull!" & @CRLF & _ "Result of 'IsSoundCardEnabled?': " & $iEnabled) If $iEnabled = -1 Then $oRemoteMedia.Open("c:windowsmediaWindows XP Startup.wav") If Not @error Then MsgBox($MB_SYSTEMMODAL, "Remote Test", "Playing sound on a remote computer successful !") EndIf Else MsgBox($MB_SYSTEMMODAL, "Remote Test", "Invoking a method on a remote Object Failed !") EndIf Exit ; ------------------------ ; My custom error function Func MyErrFunc() Local $sHexnum = Hex($g_oErrObj.number, 8) MsgBox($MB_SYSTEMMODAL, "", "We intercepted a COM Error!!" & @CRLF & @CRLF & _ "err.description is: " & $g_oErrObj.description & @CRLF & _ "err.windescription is: " & $g_oErrObj.windescription & @CRLF & _ "err.lastdllerror is: " & $g_oErrObj.lastdllerror & @CRLF & _ "err.scriptline is: " & $g_oErrObj.scriptline & @CRLF & _ "err.number is: " & $sHexnum & @CRLF & _ "err.source is: " & $g_oErrObj.source & @CRLF & _ "err.helpfile is: " & $g_oErrObj.helpfile & @CRLF & _ "err.helpcontext is: " & $g_oErrObj.helpcontext _ ) $g_nCOMError = $g_oErrObj.number EndFunc ;==>MyErrFunc the script is meant to call the media player object and then play a sound on the machine however i am getting the following error : We intercepted a COM Error!! err.description is: err.windescription is: No such interface supported err.lastdllerror is: 0 err.scriptline is: 24 err.number is: 80004002 err.source is: err.helpfile is: err.helpcontext is: Link to comment Share on other sites More sharing options...
MikahS Posted November 4, 2014 Share Posted November 4, 2014 The script will have to actually be running on the remote machine to make interactions with the programs on that certain machine. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 4, 2014 Author Share Posted November 4, 2014 Hi Mikahs , Thank you for your quick reply . how would this be as the syntax's is as follows "ObjCreate ( "classname" [, "servername" [, "username" [, "password"]]] )" where you can set the server name, username and password? i know that i can run the script locally however i would like to run the object by calling it from another machine. The example script also states to supply a remote PC : #include <MsgBoxConstants.au3>; Open the MediaPlayer on a REMOTE computerLocal $oRemoteMedia = ObjCreate("MediaPlayer.MediaPlayer.1", "name-of-remote-computer")If Not @error Then MsgBox($MB_SYSTEMMODAL, "Remote ObjCreate Test", "ObjCreate() of a remote Mediaplayer Object successful !") $oRemoteMedia.Open(@WindowsDir & "mediatada.wav") ; Play sound if file is presentElse MsgBox($MB_SYSTEMMODAL, "Remote ObjCreate Test", "Failed to open remote Object. Error code: " & Hex(@error, 8))EndIf many thanks Link to comment Share on other sites More sharing options...
water Posted November 4, 2014 Share Posted November 4, 2014 The object is created on the remote machine but everything else happens on the local machine. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 leighlandwhitehead,We do not permit multiple accounts - I have deleted the 2 others you created in case you were wondering why they no longer worked. Please just stick to this one from now on. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 4, 2014 Author Share Posted November 4, 2014 thank you Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 4, 2014 Author Share Posted November 4, 2014 Hi Water , thanks , would you recommend another way to manipulate a remote object ? many thanks Link to comment Share on other sites More sharing options...
MikahS Posted November 4, 2014 Share Posted November 4, 2014 Have a look at this example script: >link Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
water Posted November 4, 2014 Share Posted November 4, 2014 My understanding is that everything object related is executed on the remote machine. Everything else on the local. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 4, 2014 Author Share Posted November 4, 2014 My understanding is that everything object related is executed on the remote machine. Everything else on the local. Same here , in the example you open the following $oRemoteMedia.Open("c:windowsmediaWindows XP Startup.wav") Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 6, 2014 Author Share Posted November 6, 2014 Hi Guys, anyone got any more ideas ? thanks alot Link to comment Share on other sites More sharing options...
water Posted November 6, 2014 Share Posted November 6, 2014 You got the COM error on line 24. Which statement is line 24 (I'm too lazy to copy your code and count the lines)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 6, 2014 Author Share Posted November 6, 2014 Hi Water this is the line : Local $oRemoteMedia = ObjCreate("MediaPlayer.MediaPlayer.1", $sRemoteComputer,$sRemoteUsername,$sRemotePassword) many thanks Link to comment Share on other sites More sharing options...
orbs Posted November 6, 2014 Share Posted November 6, 2014 let me jump in to show you how ignorant i am when it comes to Obj stuff: googling 80004002 show it relates to Windows Update. why would you get error 80004002 for something related to Windows Media Player? secondly, i was under the impression that the application you intend to connect to over DCOM should already be running. what do you get if Windows Media Player is already running on the remote machine and then you launch your script on the local machine? and speaking of DCOM, is it enabled on the remote machine? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
water Posted November 6, 2014 Share Posted November 6, 2014 When you try to run it on your local computer (means: removing , $sRemoteComputer, $sRemoteUsername, $sRemotePassword from ObjCreate), does it work? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted November 6, 2014 Share Posted November 6, 2014 googling 80004002 show it relates to Windows Update. why would you get error 80004002 for something related to Windows Media Player? secondly, i was under the impression that the application you intend to connect to over DCOM should already be running. what do you get if Windows Media Player is already running on the remote machine and then you launch your script on the local machine? and speaking of DCOM, is it enabled on the remote machine? 80004002 is not related to Windows Update. The error simply means: No such interface supported Usually you do an ObjGet to check if the application is already running. If True you process the returned object, if False you use ObjCreate to start up the application. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 6, 2014 Author Share Posted November 6, 2014 Hi Orbs , i have tried this with media player open and i still receive the same error message, i have also made sure that all updates are on the remote PC. Water - the script does run fine locally without the following params $sRemoteComputer, $sRemoteUsername, $sRemotePassword from ObjCreate thanks Link to comment Share on other sites More sharing options...
water Posted November 6, 2014 Share Posted November 6, 2014 Your local machiine is Windows XP as well? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
leighlandwhitehead Posted November 6, 2014 Author Share Posted November 6, 2014 Hi Water , the machines are both windows 7 - i have amended the script i just copied in the original example thanks Link to comment Share on other sites More sharing options...
water Posted November 6, 2014 Share Posted November 6, 2014 (edited) What if you remove the ".1" from the classname? Local $oRemoteMedia = ObjCreate("MediaPlayer.MediaPlayer", $sRemoteComputer, $sRemoteUsername, $sRemotePassword) Edited November 6, 2014 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now