Erreur lors de la collecte Collecte de mac adresse de stations distantes en Visual Basic Access 2007 fonction GetMACAddress

Bonjour et bonne année (il est encore temps),
Nous avons développé  en VBA sous Access 2003 (migrée sous Access  2007),  une  application qui, pour un hostname netbios saisi, récolte sur
le réseau l’@ mac associée. Les hostnames peuvent correspondre à des
stations Windows, unix, imprimantes, ...
Nous utilisons pour cela la fonction getmacaddress utilisant les commandes
NBASTAT et la fonction Copymemory de la librairie
kernel32 (voir la programmation plus loin)
Il semble que depuis que nous avons migré en Windows 7,  cette application ne fonctionne plus, l’application se refermant sur erreur.
Après test, j’ai constaté qu’elle fonctionne  toujours correctement sur station XP.
J’ai essayé d’utiliser les commandes wmi en lieu et place de
NBASTAT : Wmi ne retourne que les macadresses correspondant à des stations Windows et ne répond donc pas à notre besoin.
 Auriez vous une solution pour continuer à btenir les macaddress et adresses IP ip des matériels réseau distants (stations Windows, unix, impimantes, ...) par
programmation sous Access VBA en Windows 7 ?
Un grand Merci d’avance
GetMacaddress :
Public Function GetMACAddress(ByVal NameHost As String) As String
    On Error Resume Next
    Dim tmp As String, pASTAT As Long
    Dim NCB As NET_CONTROL_BLOCK, AST As ASTAT
    Dim NameOK As Boolean
    Dim t
    Dim octet0 As String
    Dim octet1 As String
    Dim octet2 As String
    Dim octet3 As String
    Dim octet4 As String
    Dim octet5 As String
    NCB.ncb_command = NCBRESET
    Call Netbios(NCB)
    NCB.ncb_callname = NameHost
    NCB.ncb_command = NCBASTAT
    NCB.ncb_lana_num = 0
    NCB.ncb_length = Len(AST)
    pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, NCB.ncb_length)
    If pASTAT = 0 Then
        Debug.Print "Erreur d'allocation memoire"
        Exit Function
    End If
    NCB.ncb_buffer = pASTAT
    Call Netbios(NCB)
    CopyMemory AST, NCB.ncb_buffer, Len(AST)
    NameOK = False
    For t = 0 To 5
        If AST.adapt.adapter_address(t) <> 0 Then
            NameOK = True
            Exit For
        End If
    Next
    If NameOK = True Then
        octet0 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(0)), 2)
        octet1 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(1)), 2)
        octet2 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(2)), 2)
        octet3 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(3)), 2)
        octet4 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(4)), 2)
        octet5 = VBA.Right("0" & VBA.Hex(AST.adapt.adapter_address(5)), 2)
        tmp = octet0 & "-" & octet1 & "-" & octet2 & "-" & octet3 & "-" & octet4 & "-" & octet5
        HeapFree GetProcessHeap(), 0, pASTAT
        GetMACAddress = tmp
    Else
        GetMACAddress = "-1"
    End If
End Function
WMI :
Public Function Macadresse() As String
Dim computer As String
Dim wmi As Object
Dim vadapter As Object
Dim query As Variant
Dim mac As Object
Dim mac_ids As String
computer = "hostnamestationdistante"
Set wmi = GetObject("winmgmts:\\" & computer & "\root\cimv2")
'Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2")
Set vadapter = wmi.execquery("select * from win32_networkadapterconfiguration where Ipenabled = true")
For Each mac In vadapter
    mac_ids = mac_ids & ", " & mac.macaddress
Next mac
If Len(mac_ids) > 0 Then mac_ids = Mid$(mac_ids, 3)
Macadresse = mac_ids
End Function

Similar Messages

  • Service de publication - Message d'erreur lors mise à jour collection Flickr

    Bonjour,
    Je suis sous Mac OS X 10.8.2 et cela fait plusieurs mois que j'utilise LR (actuellement en v 4.3 [865747]). J'utilise depuis longtemps le service de publication Flickr et jusqu'à il y a 1h cela marchait correctement. Maintenant que je veux publier (mettre à jour) une collection j'ai le message d'erreur suivant
    Impossible de mettre à jour cette collection.
    Une erreur interne s'est produite : Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
    " UserInfo=0x17a1a6160 {NSLocalizedDescription=Line 1: Document is empty
    J'ai toujours le même message même si je quitte le logiciel. Pour information ce problème est survenu apèrs avoir rajouter les tags "n&b" et "b&w" à des photos.
    Pouvez-vous m'aider?

    Bonjour,
    Je suis sous Mac OS X 10.8.2 et cela fait plusieurs mois que j'utilise LR (actuellement en v 4.3 [865747]). J'utilise depuis longtemps le service de publication Flickr et jusqu'à il y a 1h cela marchait correctement. Maintenant que je veux publier (mettre à jour) une collection j'ai le message d'erreur suivant
    Impossible de mettre à jour cette collection.
    Une erreur interne s'est produite : Error Domain=NSXMLParserErrorDomain Code=4 "Line 1: Document is empty
    " UserInfo=0x17a1a6160 {NSLocalizedDescription=Line 1: Document is empty
    J'ai toujours le même message même si je quitte le logiciel. Pour information ce problème est survenu apèrs avoir rajouter les tags "n&b" et "b&w" à des photos.
    Pouvez-vous m'aider?

  • I am interested in purchasing Adobe's Creative Suite 6 Master Collection for Mac and Windows (Single User Educational License) FOR STUDENTS & EDUCATORS ONLY.

         I am interested in purchasing Adobe's Creative Suite 6 Master Collection for Mac and Windows (Single User Educational License) FOR STUDENTS & EDUCATORS ONLY. I am purchasing this program for my son who attends George Washington High School: The College Academy in New York, New York. He is a sophomore and is interested in web design. I would like to know if he is eligible to use/activate the Creative Suite 6 Master Collection for Mac and Windows (Single User Educational License) FOR STUDENTS & EDUCATORS ONLY prior to my purchase.

    Peru Bob makes a good point.  I just assumed the OP understood what the System requirements | Adobe Creative Suite 6 were.
    Nancy O.

  • Unable to install CS6 master collection for mac book pro(late 2011)

    Recently, I have successfully downloaded Adobe creative suite CS6 master collection for MAC.
    However, I am unable to install it. After opening the installer nothing happens, it does not proceed further. I have tried copying the contents from MasterCollection_CS6_LS16.dmg to another folder and then open the install.app, still no progress.
    Please advice since I really need to install this.
    Screenshot below:

    Hey Vikrant thanks for the response.
    The situation is like this, I downloaded the image on my desktop pc(which is windows) and then compress & split the image using a winrar. I then transferred the files to my mac book pro and extracted the image there. Unfortunately, there was a bug in the unarchiver software that I was using on mac to extract the image.
    This bug was rectified today in a update given out by the dev.
    Now, I can install CS6 without any issues. Thanks for the repsonse once again.

  • Adobe CS6 Master Collection for Mac licensing

    I installed Adobe CS6 Master Collection for Mac, licensed it and updated it on twenty iMacs.  This a University computer lab with many users.  Sometimes Adobe software starts in trial mode as if the license key hasn't been entered.  What could be the problem?

    Hi Gutech,
    Could you please tell me how did you install Master Collection on 20 machines.
    If you have installed Master Collection on 1 Mac and created an Image of the OS and then installed it on the 20 Mac's then you may come across with this kind of issue.
    In Order to properly deploy the Master Collection please use our Deloyment Tool to create a Serialised Package and then use the same to deploy it on the 20 Mac's.
    You can find the Deployment Tools in this Link
    http://www.adobe.com/devnet/creativesuite/enterprisedeployment.html
    Regards,

  • Using CS5.5 Master Collection for MAC, I can't use "Replace with After Effects composition"

    Using CS5.5 Master Collection for MAC, I can't use "Replace with After Effects composition" because I updated AE to CS6 (but only AE). Even that AE CS 5.5 is still installed, it won't connetct.
    How can that be fixed?
    Thanks a lot for any suggestions.

    Thanks for the answer: I tried different ways (after I read your suggestion) but it always changes back right away ... I can't change it.
    Am 16.01.2013 um 03:04 schrieb Jim Simon:
    Re: Using CS5.5 Master Collection for MAC, I can't use "Replace with After Effects composition"
    created by Jim Simon in Premiere Pro CS5, CS5.5, & CS6 - View the full discussion
    Maybe try associating AE project files with 5.5 instead of 6.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4997081#4997081
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4997081#4997081
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4997081#4997081. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Premiere Pro CS5, CS5.5, & CS6 by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Problème lors de l'extinction de mon Mac Book Pro.

    Bonjour,
    Lors de l'extinction de mon Mac Book Pro, l'écran blanc avec la molette de chargement s'affiche et le mac ne s'éteint pas ! La seul solution que j'ai est de forcer l'extinction en restant appuyé sur le bouton de démarrage. Que faire?

    Essayez ceci:
    http://support.apple.com/kb/HT3964?viewlocale=fr_FR

  • Messzge d'erreur  lors du chargement d'Adobe Player sous windows 7Erreur lors de l'application du programme correctif au fichier C : \ Config.Msi\PTF6DD.tmp.

    Lors du chargement d'Adobe Player  sous Windows 7 le chargement se fait jusqu'à 97% et affiche le message d'erreur suivant: Erreur lors de l’application du programme correctif au fichier C : \ Config.Msi\PTF6DD.tmp. Il a sans doute été mis à jour de manière différente et ne peut plus être modifié par ce programme correctif. Pour obtenir des informations complémentaires, contactez le revendeur de votre programme correctif. Que faut-il faire.

    Uninstall using http://labs.adobe.com/downloads/acrobatcleaner.html
    then reinstall from http://get.adobe.com/reader/enterprise/

  • Erreur lors de l'insertion de l'objet ActiveX: la classe n'a pas de licence d'utilisation

    Bonjour
    Je viens d'installer LabVIEW 7, et lorsque je cherche à insérer un objet ActiveX dans un conteneur ActiveX comme auparavant sous LabVIEW 6i et 6.1, j'ai le message d'erreur suivant qui apparaît:
    "Erreur lors de l'insertion de l'objet ActiveX: la classe n'a pas de licence d'utilisation".
    Petite précision, je travaille sous Windows 2000 Pro avec le Service Pack 4.
    Merci d'avance pour toute aide.

    Bonjour,
    Les exemples ActiveX présent dans LV génèrent-ils le même message d'erreur?
    Ces exemples se trouvent dans Aide>>Recherche d'exemple>>Communication avec les applications externes>>ActiveX.
    Essayez d’insérer un objet Microsoft Office. Par exemple, « Microsoft Office Spreadsheet », obtenez-vous le même message d’erreur ?
    Une solution serait d'enregistrer manuellement les commandes ActiveX présent dans votre poste.
    Le document ci-dessous explique la procédure à suivre :
    http://digital.ni.com/public.nsf/websearch/4F811A9B23F1D46E862566F700615B7A?OpenDocument
    Suivez les instructions dans la partie : "ActiveX Controls".
    Merci de faire le test et de me tenir au courant du résultat.
    Cordialement,
    Sanaa TAZI
    National Instruments France
    Sanaa T.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> http://www.nidays.fr/images/081110_ban_nidays09_468X60.gif

  • Erreur lors de la construction de l'éxecutable

    Erreur lors de la création de l'executable:
    Une erreur s'est produite lors de l'enregistrement du fichier suivant :
    C:\Program Files\National Instruments\LabVIEW 2009\vi.lib\addons\Wavelet Analysis\discrete wavelet transform.llb\WA Get Coefficients of 1D Discrete Wavelet Transform (Array).vi
    Nœud de méthode dans AB_Source_VI.lvclass:Close_Reference.vi->AB_Build.lvclass:Copy_Files.vi->AB_Application.lvclass:Copy_Files.vi->AB_EXE.lvclass:Copy_Files.vi->AB_Build.lvclass:Build.vi->AB_Application.lvclass:Build.vi->AB_EXE.lvclass:Build.vi->AB_Engine_Build.vi->AB_Build_Invoke.vi->AB_Build_Invoke.vi.ProxyCaller
    <APPEND>
    Nom de la méthode : <b>Save:Target Instrument</b>

    Résolu :
    Problème de droit (lecture seule) sur le dossier de destination de l'éxecutable

  • Erreur lors de l'obtention de la licence. Problème de communication avec le serveur de licences : E_ACT_NOT_READY ?

    Erreur lors de l'obtention de la licence. Problème de communication avec le serveur de licences :
    E_ACT_NOT_READY

    Bonjour,
    comment avez vous réglé le pblm ?

  • J ai re initialisé mon mot de passe mais impossible de se connecter, message = erreur lors de la connection. Que dois je faire ?

    Bonjour,
    Impossible de se connecter, le message dit "erreur lors de la connection", j ai réinitialisé mon mot de passe mais ça ne fonctionne pas. Que dois je faire ? Merci

    J'en ai aucune idée ! J'y connais rien a ces trucs...
    Ceci sont les infos generales de mon Ordi :
    Model Name: MacBook Pro
      Model Identifier: MacBookPro8,1
      Processor Name: Intel Core i7
      Processor Speed: 2,7 GHz
      Number of Processors: 1
      Total Number of Cores: 2
      L2 Cache (per Core): 256 KB
      L3 Cache: 4 MB
      Memory: 4 GB
      Boot ROM Version: MBP81.0047.B24
      SMC Version (system): 1.68f98
      Serial Number (system): C02F46K0DH2H
      Hardware UUID: 2C283FA4-3387-582A-B9A3-BF387C473CFA
      Sudden Motion Sensor:
      State: Enabled
    Saurais tu me guider et m'aider a resoudre le probleme ?

  • Comment réparer une "erreur lors de l'obtention de la licence "Adobe Digital Editions

    Bonjour,
    voici le message que je reçois lorsque j'essaie de télécharger un livre numérique:
    "Téléchargement impossible
    Erreur lors de l'obtention de la licence. Problème de communication avec le serveur de licences:
    E_LIC_ALREADY_FULFILLED_BY_ANOTHER_USER"
    J'ai désintallé et réinstallé Digital Editions, mais j'ai toujours le même message.
    J'ai demandé de réinitialiser un autre mot de passe: échec à nouveau.
    Auriez-vous une solution?
    Merci de votre aide.
    Jeannette

    http://helpx.adobe.com/digital-editions/kb/e-lic-already-fulfilled.html

  • After hours of back-up, downloading and uploading...I am now updated with all the latest Mac software. However, I no longer have access to Excel and Word. Is there a way I can access my documents in either of those? Help, please.

    After hours of back-up, downloading and uploading...I am now updated with all the latest Mac software. However, I no longer have access to Excel and Word. Is there a way I can access my documents in either of those? Help, please.

    If you have older versions of excel and word that previously ran under the Rosetta emulator (allows PowerPC code to run on Intel system), they will no longer work with Lion.
    You can use the Apple programs Pages and Numbers to access the files. They can be bought and downloaded from the App store. NeoOffice is available at http://www.neooffice.org/neojava/en/index.php which has Lion support. OpenOffice doesn't talk to Lion support, it's at http://www.openoffice.org/

  • How to Fetch MAC-Adresses across Subnets

    Hi All,
    for some reason we have a number of Machines out there where we would like to install a Package via ARD instead of Casper. We have a list of Hostnames from this Machines. Now, the first idea was to ping them and to get the MAC-Adress out of the ARP Cache via arp -a. All together could be used as an Import-File for Remote-Desktop.
    But ARP does not work across Subnets.
    Now i was wondering - how does for example ARD read the MAC-Adress from a Machine if i do a scan to a specific Network-Range. Could i use this process to fetch the MAC-Addresses? Or could there be another way.
    bye
    joe

    Hi
    You could try installing ARD on a client within that range? Poll workstations within that range for relevant information. Save it to the Desktop of that ARD workstation. Transfer it to a memory stick etc. Or if you know the IP address of that workstation you may be able to add it using the network address option from another workstation that's in a different subnet.
    Tony

Maybe you are looking for