Script wmi

Hello all,
I need help for an script wmi to output excel, this script work fine but I would add function to export.
This function is UserName (login user)in the script.
Please help me.
' text file to read from
strReadFile = "C:\computers.txt"
' excel file to create
sXLS = "C:\service tags.xls"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(strReadFile)
Set objShell = CreateObject("WScript.Shell")
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.DisplayAlerts = False
objExcel.Visible = True
objExcel.Workbooks.Add
' define the column titles
objExcel.Cells(1,1).Value = "Computer Name"
objExcel.Cells(1,2).Value = "Model"
objExcel.Cells(1,3).Value = "Service Tag"
xRow = 1
yColumn = 1
' apply styles to rows and columns
Do Until yColumn = 4
objExcel.Cells(xRow,yColumn).Font.Bold = True
objExcel.Cells(xRow,yColumn).Font.Size = 11
objExcel.Cells(xRow,yColumn).Interior.ColorIndex = 11
objExcel.Cells(xRow,yColumn).Interior.Pattern = 1
objExcel.Cells(xRow,yColumn).Font.ColorIndex = 2
objExcel.Cells(xRow,yColumn).Borders.LineStyle = 1
objExcel.Cells(xRow,yColumn).WrapText = True
yColumn = yColumn + 1
Loop
x = 2
y = 1
' start reading from the text file, until the end
Do Until objTS.AtEndOfStream
strComputer = objTS.ReadLine
' check if the computername is pingbale, if not then skip to next name
If (IsPingable(strComputer) = True) then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("SELECT * FROM Win32_ComputerSystemProduct","WQL",48)
y1 = y
If Err.number=0 Then
For Each objComputer in colComputer
objExcel.Cells(x,y1).Value = strComputer
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = objComputer.Name
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = objComputer.IdentifyingNumber
x = x + 1 ' go to the next Row
Next
Else
objExcel.Cells(x,y1).Value = strComputer
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = "Model not found!"
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = "Serial not found!"
x = x + 1 ' go to the next Row
End If
Err.clear
Else
objExcel.Cells(x,y1).Value = strComputer
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = "Not Pingable"
x = x + 1 ' go to the next Row
End If
Loop
objExcel.Columns("A:C").Select
objExcel.Selection.HorizontalAlignment = 3 'center all data
objExcel.Selection.Borders.LineStyle = 1 'apply borders
objExcel.Columns("A:AH").EntireColumn.AutoFit 'autofit all columns
Const Excel07 = 12
appVerInt = split(objExcel.Version, ".")(0)
If appVerInt- Excel07 >=0 Then
objExcel.ActiveWorkbook.SaveAs(sXLS), 56 'You use office 2007 / 2010
Else
objExcel.ActiveWorkbook.SaveAs(sXLS), 43 'You use office 97-2003
End If
objExcel.Quit
set objExcel = Nothing
objTS.Close
msgbox "Done!"
WScript.Quit
Function IsPingable(ByVal strHost)
If Trim(strHost) <> "" Then
strCommand = "Ping.exe -n 3 -w 750 " & strHost
Set objExecObject = objShell.Exec _
("%comspec% /c title " & strHost _
& chr(38) & strCommand)
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadLine()
If Instr(strText, "TTL=") > 0 _
Then IsPingable = True : Exit Do
Loop
If IsPingable = True then
With GetObject("winmgmts:root\cimv2")
For Each objProcess in .ExecQuery _
("SELECT commandline FROM Win32_Process" _
& " WHERE Name = 'ping.exe'",,48)
If objProcess.commandline = strCommand _
Then objProcess.Terminate() : Exit For
Next
End With
End If
End If
If (not IsPingable = True) Then IsPingable = False
End Function

Set colComputer = objWMIService.ExecQuery _
("SELECT * FROM Win32_ComputerSystem","",48)
y1 = y
If Err.number=0 Then
For Each objComputer in colComputer
objExcel.Cells(x,y1).Value = strComputer
y1 = y1 + 1 ' go to next column
objExcel.Cells(x,y1).Value = objItem.Username
y1 = y1 + 1 ' go to next column
objItem.UserName
I know and this  why I would like to add this feature to output excel but I don't know, see in example for understand

Similar Messages

  • OSD, ADSI Script run fail in WinPE5.1(ADK 8.1)

    I want to run ADSI script to check if there is a computer in domain.  If I find this computer account already exists in domain then you can join domain. My script as below.
    But it can't work in winpe. it said "Table does not exist" of code "Set objRecordSet = objCommand.Execute". BTW, this script run fine in standard system and the boot image had been
    installed all cab plugin(Script,WMI...).
    I know it should miss some ADSI related plugin. I want to know how to make this script work or how to check if there is a computer acount in domain. 
    strUser="Name"
    strPassword="Password"
    PcName="Computer"
    Const ADS_SCOPE_SUBTREE = 2
    Const ADS_SECURE_AUTHENTICATION = &H1 
    Const ADS_SERVER_BIND = &H200 
    Dim objConnection, objCommand, objRecordSet 
    Set objConnection = CreateObject("ADODB.Connection")
    Set objCommand =   CreateObject("ADODB.Command")
    objConnection.Provider = "ADsDSOObject"
    objConnection.Properties("User ID") = strUser
    objConnection.Properties("Password") = strPassword
    objConnection.Properties("Encrypt Password") = True
    objConnection.Properties("ADSI Flag") = ADS_SERVER_BIND Or ADS_SECURE_AUTHENTICATION
    objConnection.Open "Active Directory Provider"
    Set objCommand.ActiveConnection = objConnection
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    objCommand.CommandText = "SELECT ADsPath FROM 'LDAP://dc=abc,dc=com' WHERE objectCategory='computer' AND Name='" & PcName & "'"
    Set objRecordSet = objCommand.Execute
    If objRecordSet.PageCount Then
        IsPCname="True"        
    Else 
        IsPCname="False"
    End If
    WScript.Echo IsPCname

    Hi,
    Johan has a great blog post on how to add ADSI support in WinPE 5 here:
    http://www.deploymentresearch.com/Research/tabid/62/EntryId/128/ADSI-plugin-for-WinPE-5-0.aspx
    It explains all the steps.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • HP Drive Encryption Software

    I am helping a friend setup their new laptop, but cannot find any information on what's needed to setup the Drive and Email Encryption software, only the basic information on the "product info" sheet I saw when they decided to buy this model.
    Is there a manual for HP ProtectTools, so i can really familiarise myself with all of the various features - including fingerprint recognition and the protection of USB memory keys (which I've already had to work out how to turn off because it was interfering with their use of drives too much.
    If I could read the guide, perhaps I could understand how to configure the protection to work the way they'd like it. If you can help me find this, I'd be very grateful.
    Julia Evans

    I am sure that is not a surprising answer, have you thought about Bitlocker http://windows.microsoft.com/en-US/windows7/products/features/bitlocker
    - you need Win 7 Ultimate or Enterprise
    - works great with TPM (without TPM look in Win 8)
    - manage it with in AD (with an Enterprise Agreement you can do MBAM)
    - add some scripts (WMI) for reporting
    - configure GPOs so that all recovery keys are stored centrally and make seperate backups of all recovery info in AD just in case the machine account gets deleted and recreated and you need after 2years the recovery key 
    My experience with 3rd parties are not good either, regardless who it was.
    Hope that helps,
    Lutz

  • Windows 7 has no notification of RAID failure?

    This is a repost of this thread: http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/a77c6445-e504-4394-a945-7a6c096e0871 
    Per Technet, being a subscriber guarantees me a response from a Microsoft Engineer within two business days, but the previous thread was not answered satisfactorily, and now Microsoft seems to be ignoring it.  Since my previous thread went unresolved
    and this is of critical importance, I chose to repost this and get a real answer from Microsoft.
    Having Software RAID as a built-in option seems like a great idea. Hard disks are notoriously unreliable, and they carry the most important part of our technological world: our data. Being able to easily build a software RAID from two cheap 1TB drives gives
    me so much piece of mind ... or does it?
    I've noticed my software RAID seems to be periodically losing sync.* This is worrisome (maybe a drive is failing?) but not nearly as worrisome as HOW I noticed it. For some reason, after cruising along smoothly for several months with my RAID 1, I decided
    to check on its status in Computer Management -> Disk Management. And, oh nos! there was my software RAID with a Failed Redundancy Error. I had to "Reactivate Disk" and it started resynching. I decided to check again every so often and everything was fine
    again for a while until I lost synch again.
    Again, my losing synch is not the point of this post. My point is why was there NO NOTIFICATION of my synchronization loss? I have NO IDEA how long my drives had lost synchronization before I stumbled upon that fact the first time. What is the point of software
    RAID if Windows does not inform you that it has failed? I could lose one drive, go cruising along for months thinking I'm fine, then lose the other drive and POW! I'm left with nothing due to a false sense of security (please no lectures on RAID being for
    reducing downtime and not for use as a backup solution - I KNOW).
    I just had another loss of synchronization, and I checked around to see if I had been notified anywhere else (the Action Center seems like it could be a good candidate for this). Finding nothing, I've come here to post my concerns.
    But in order to maintain my required level of uptime, I need to KNOW when a drive has failed redundancy so I can correct the situation (by replacing the drive or other). Where is the notification that I am running on only one drive?
    Update: In the previous thread, it was suggested I use the Windows Task Scheduler to make my own custom notification based on RAID failure events in the Event Viewer.  After investigating this unnecessarily obtuse (but usable) solution, it was found
    that Windows 7 does not generate any events for RAID synchronization failures.  This is astounding.  What I really want is graphical, e-mail, and event notification of a drive failure.  I will take just an event.  I find it amazing that
    the new "Action Center" thinks it is important enough to tell me that my Flash player has a problem, but can't let me know that a drive is failing.  This seems like the perfect job for an OS notification system: to warn you when the feces is about to
    impact the ventilator.
    *Update: the disk in question ended up dying completely and was replaced under warranty with no problems and the machine is now happily cruising along with 2 working and synchronized hard drives once again.  I would have never noticed I had a failed
    hard drive if I didn't check on my own.

    This is another Kludge that works on Windows 7
    Microsoft Sysinternals has the BGInfo tool, which you can add vbscripts to generate additional data that gets included in the display.
    For example:
    Fields
    - Custom - New - 'MyRAID'
    * VB Script file
    Path: C:\raidchk.vbs
    The contents of raidchk.vbs are below and belong to three websites, put together.
    Site A. provided the idea for a vbscript to parse the diskpart.exe info
    Site B. provided a better script that produced wscript messages
    Site C. explained the wscript object was not available in VB script and to use Createobject instead
    Once the script is generating output, adding it to the BGInfo configuration display is as easy as adding the line:
    MyRAID:   <MyRAID>
    The output of the script gets substituted into the display field.
    An improvement would be to WinTask schedule it to periodically update it. The length of the message output will dynamically "shift" the display front an center when a major event happens. The Vbscript could also include a. email, b. eventlogger,
    c. whistles and bells audio.. ect..
    The reason the information is so hard to get at appears to be because VDS is a COM object based service, which brokers a user tool connection to vendor raid COM interface. There is no native wmi provider that will subscribe to the Microsoft RAID notifications
    and provide status information, let alone bind to a notification service like email or eventx. diskpart or dmadmin are the limits provided.
    But it almost looks like something Powershell could handle.
    VDS Under PowerShell - a hint that it could be done
    Some references that the information is readily available:
    Volume Object- Mirror is a type of volume to VDS
    VDS_VOLUME_PROP structure - a VDS volume has a status structure
    status - A
    VDS_VOLUME_STATUS enumeration value that specifies the status of the volume.
    health - A
    VDS_HEALTH enumeration value that specifies the health state of the volume.
    TransitionState - A
    VDS_TRANSITION_STATE enumeration value that specifies the transition state of the volume.
    VDS_VOLUME_NOTIFICATION structure - a VDS volume
    An application can receive volume events by implementing the
    IVdsAdviseSink interface and passing the interface pointer as an argument to the
    IVdsService::Advise method.
    To get the volume object, use the
    IVdsService::GetObject method. You can then use the
    IVdsVolume::GetProperties method or the
    IVdsVolume2::GetProperties2 method to get the volume properties.
    VDS Notifications
    I say that without looking around very much. The recommended language for implementing a provider are C/C++ ect.. although I've never heard of a VB script wmi provider.. I think there would be data type language problems. Thus we are left with polling
    as with most scripting, or some sort of event trigger like a eventx alert that will run a script as needed. The Advanced XMLconfig for Windows Task Scheduler in Win 7/2008 is quite advanced and has a fine degree of control for matching events if there are
    events being logged by the VDS service with actual source data.
    VDS is on the way out, the COM interface is deprecated and will not support storage spaces, likewise the API and tools for Storage Spaces will not support VDS. This is a "take a leap of faith" moment.
    I tend to prefer to wait a year or two before trusting my data to the effort.
    As for Software vs Intel ICH vs dedicated HBA ?
    I'm interested at a low level for personal use, something easy and reliable beyond Tape backup or any system that requires me to perform an action, or allocate huge amounts of reduced performance time to feed the Tapes, feed the Backup service.. ect.
    I have tried every variation possible and come to the conclusion that at one time Hardware raid made sense on an enterprise level. But never the consumer. The RAID built into the motherboard tends to stay with the motherboard if that dies. Ditto with the
    HBA and its impossible trying to source a compatible HBA a season or two after the latest greatest hardware release. A long term available HBA is going to cost lots of money, because they have no other way to make back the money they could have made by releasing
    more new product, or to pay for the space to store the inventory. Ebay is not a great hardware vendor HBA sourcing plan. Tape backup and any major network backup system are too slow.
    At the same time, BIOS/UEFI being what it is, trusting a bootable volume to RAID between versions from the same manufacturer or differerent manufacturers is fool hardy. There is no incentive for cross vendor bootable RAID support. So plan to burn the bootable
    operating system drive, its expendable. Deliberately move the profile and data regions to either junction points or off to the mirror array. When a drive dies, replace it, when a motherboard dies replace it and reinstall the operating system. When all else
    fails, import the foreign "soft" raid mirror into another operating system.. and with 2003/XP being over 13 years old and still kicking.. that trumps any hardware vendor for longevity. If W7 lasts that long.. or longer.. it will be a good run. W8/2012
    are in their infancy and have a lot of testing to go through in the real world.
    And for offsite replication, static archiving. There is always eSATA and an external drive that could be added to the mirror and subsequently broken. Being natively driven by the operating system I would suspect it would be reliable.. but testing is always
    the best way to shore up belief.
    ' Lists all logical drives on the local computer which are configured for
    ' software RAID. Returns an %ERRORLEVEL% of 1 if any redundant drive is
    ' not in a "Healthy" state. Returns 0 otherwise.
    ' Supports Windows Vista/7, Windows 2008/R2
    Option Explicit
    Dim WshShell, oExec
    Dim RegexParse
    Dim hasError : hasError = 0
    Set WshShell = CreateObject("WScript.Shell")
    Set RegexParse = New RegExp
    ' Execute diskpart
    Set oExec = WshShell.Exec("%comspec% /c echo list volume | diskpart.exe")
    RegexParse.Pattern = "\s\s(Volume\s\d)\s+([A-Z])\s+(.*)\s\s(NTFS|FAT)\s+(Mirror|RAID-5)\s+(\d+)\s+(..)\s\s([A-Za-z]*\s?[A-Za-z]*)(\s\s)*.*"
    While Not oExec.StdOut.AtEndOfStream
    Dim regexMatches
    Dim Volume, Drive, Description, Redundancy, RaidStatus
    Dim CurrentLine : CurrentLine = oExec.StdOut.ReadLine
    Set regexMatches = RegexParse.Execute(CurrentLine)
    If (regexMatches.Count > 0) Then
    Dim match
    Set match = regexMatches(0)
    If match.SubMatches.Count >= 8 Then
    Volume = match.SubMatches(0)
    Drive = match.SubMatches(1)
    Description = Trim(match.SubMatches(2))
    Redundancy = match.SubMatches(4)
    RaidStatus = Trim(match.SubMatches(7))
    End If
    If RaidStatus <> "Healthy" Then
    hasError = 1
    Echo "**WARNING** "
    End If
    Echo "Status of " & Redundancy & " " & Drive & ": (" & Description & ") is """ & RaidStatus & """"
    End If
    Wend
    If (hasError) Then
    Echo ""
    Echo "WARNING: One or more redundant drives are not in a ""Healthy"" state!"
    End If
    'WScript.Quit(hasError)
    -- John Willis

  • Configure DNS Setting via Powershell

    Hi,
    I am trying to get a script together that will configure a static IP address, DNS, and WINS server settings. The instructions here are great, except the DNS part doesn't work.
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/28/use-powershell-to-configure-static-ip-and-dns-settings.aspx
    Here are the commands in the script:
    $wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
    $wmi.EnableStatic("192.168.1.2", "255.255.255.0")
    $wmi.SetGateways("192.168.1.1", 1)
    $wmi.SetDNSServerSearchOrder("208.67.220.220", "208.67.222.222", "8.8.8.8")
    $wmi.SetWINSServer("192,168,1,1")
    Each time I run the script it fails on the DNS portion. I am doing this on Windows Server 2012. The specific error message is: Cannot find an overload for "SetDNSServerSearchOrder" and the argument count: "3".
    Any ideas? Thanks
    Jason Watkins MCSE, MCSA, MCDBA, CCNA

    Hi N74JW,
    What is your current situation?
    If issue insists, you may take a try to save the DNS Server into a variable, see:
    $dnsSearchOrder = "208.67.220.220", "208.67.222.222", "8.8.8.8"
    $wmi.SetDNSServerSearchOrder($dnsSearchOrder )
    Then check if issue could be solved.
    Best regards
    Michael Shao
    TechNet Community Support

  • HP Drive Encryption Software (Winmagic)

    Hi, I'm having a problem with the HP Drive Encryption Software. I had to reinstall my operating system, but I forgot the decrypt my hard drive before the reinstall. My HDD was split into 3 partitions, 1 was for the OS and the other 2 for data storage. Currently, after the reinstall, I can see the one with the OS, as it was formated during the reinstall, but as for the other 2, they are not available. Windows recognized those partitions as not formatted and when I click on them the OS says that before using the partition it needs to be formated. I was hoping that by installing the Drive Encryption Software it will be easy to recover those partitions, but apparently it wasn't. I have my old spare key stored on a external USB device, but when I was trying to recover following the guidelines I found in the Help section of the HP Client Security app (via the login screen after a restart) I run into an error. 0xa1 I believe. Is there any way to recover those partitions? I wouldnt want to format them and loose all my data. Pls advise. Thank you

    I am sure that is not a surprising answer, have you thought about Bitlocker http://windows.microsoft.com/en-US/windows7/products/features/bitlocker
    - you need Win 7 Ultimate or Enterprise
    - works great with TPM (without TPM look in Win 8)
    - manage it with in AD (with an Enterprise Agreement you can do MBAM)
    - add some scripts (WMI) for reporting
    - configure GPOs so that all recovery keys are stored centrally and make seperate backups of all recovery info in AD just in case the machine account gets deleted and recreated and you need after 2years the recovery key 
    My experience with 3rd parties are not good either, regardless who it was.
    Hope that helps,
    Lutz

  • Drive encryption software

    We have a Windows server 2008 r2 domain and running 500 windows 7 machines. We are looking into a new drive encryption software. We currently use Novell ZenWorks Full Disk Encryption. We have had several issues with this IE blue screens when installing
    the agent.
    I would like to know of some other reputable options for disk encryption. It need to be centrally managed and 256 bit encryption.
    Thanks
    Josefah

    I am sure that is not a surprising answer, have you thought about Bitlocker http://windows.microsoft.com/en-US/windows7/products/features/bitlocker
    - you need Win 7 Ultimate or Enterprise
    - works great with TPM (without TPM look in Win 8)
    - manage it with in AD (with an Enterprise Agreement you can do MBAM)
    - add some scripts (WMI) for reporting
    - configure GPOs so that all recovery keys are stored centrally and make seperate backups of all recovery info in AD just in case the machine account gets deleted and recreated and you need after 2years the recovery key 
    My experience with 3rd parties are not good either, regardless who it was.
    Hope that helps,
    Lutz

  • WMI Scripts not Running Across VPN

    Hi
    I have a strange problem where i have 2 sites connected  using  a VPN on 2  CISCO877.  But WMI scripts are not running across the link. if i pull these out an replace them with a Draytek, the scripts run fine.
    Broad Lane LAN ----- Cisco 877 ========= Internet & VPN Tunnel ============== Cisco 877 ---- Southam LAN1.0.39.0/8                      1.0.39.253                                                                                                              192.168.55.1   192.168.55.0/24 The server at Broad Lane is  GIMILI (1.0.39.109) and at Southam is FRODO (192.168.55.4). The following will not work through the tunnel from Broad Lane LAN. Set objWMIService = GetObject("winmgmts:\\192.168.55.4\root\cimv2") if err.number=0 then serverexist=true else serverexist=falsemsgbox(server.exist)
    Is is possible for the  CISCO877 to block WMI traffic?
    Any suggestions please?
    Rgds
    Phil

    Phil,
    Thank you for your question.  This community is for Cisco Small Business products and your question is in reference to a Cisco Elite/Classic product.  Please post your question in the Cisco NetPro forums located here: http://forums.cisco.com/eforum/servlet/NetProf?page=main  This forum has subject matter experts on Cisco Elite/Classic products that may be able to answer your question.
    Bill

  • Wmi script to find out the time when the user was added to local administration group

    Hi Friends,
    i need a script/query based on wmi/wql that find out the time when the user was added to local administration group on this computer
    Regards
    Tanoj
    OSLM ENGINEER - SCCM 2007 & 2012

    WMI does not keep security information.
    Unless you have enabled auditing, this information is not retained in any way.
    If auditing is enabled, you can write a powershell script to look for the specific event in the eventlog. More specifically, you should look for all security events with id 4732 containing the group.
    this one command does the trick
    get-eventlog -logname security -instanceid 4732 -message *administrators*
    https://technet.microsoft.com/en-us/library/dd772663(v=ws.10).aspx
    MCP/MCSA/MCTS/MCITP

  • Create script from wmi

    I would like to create a script in wmi that will compare the serial number pulled from the bios and compare that to a filed in a csv file and create 2 fields in the registry, so when a inventory runs it will place adf defined fields in the workstation inventory. I have two scripts that will read wmi and one that will write the registry but dont know how to get them to talk to each other and search a file with two fields.
    On Error Resume Next
    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20
    arrComputers = Array("localhost")
    For Each strComputer In arrComputers
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
    wbemFlagReturnImmediately + wbemFlagForwardOnly)
    For Each objItem In colItems
    strBiosCharacteristics = Join(objItem.BiosCharacteristics, ",")
    WScript.Echo "SERIAL=" & objItem.SerialNumber
    WScript.Echo
    Next
    Next
    Dim WshShell, bKey
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegWrite "HKLM\Software\lewisclark\WSNUM", "123", "REG_SZ"

    MGLASS,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • M58 BIOS WMI script not working

    Hoping some BIOS gurus might be able to help me out here - I have many m58 machines that need to turn on at midnight every night for updating.  I'm trying to remotely remotely enable the "Wake Up on Alarm" function in the BIOS and set it to "Daily Event".  I downloaded the m58 WMI scripts from Lenovo, but can't seem to get anything working. From the command line, I'm trying:
    C:\cscript.exe SetConfigRemote.vbs "Wake Up on Alarm" Daily Event computername
    output: SetConfigRemote.vbs [setting] [value] [hostname] 
    I've tried putting the setting, value  and hostname all in quotes, none in quotes, etc - but then I get invalid parameter errors.
    Any ideas?
    Thanks,
    Dave

    Your post confuses me because the title is about M58 but your text is about X230.  So which system are you working with?
    ThinkPad and ThinkCentre use different scripts/values.  X230 info is here:  http://support.lenovo.com/en_US/detail.page?LegacyDocID=MIGR-68488
    As for your specific example about using setconfig.vbs, it is entered wrong.  The item is "WakeOnLAN" and not "WakeOnLan".  it is case-sensitive.

  • WMI Health Check script

    Hi Experts
    I am looking client WMI health check. When I run the script it should check local WMI and give result in log file. if any issue it should reslove.
    Thanks

    Hi,
    Are you looking for this?
    http://www.microsoft.com/en-us/download/details.aspx?id=7684
    If not, you can check the script repository for prewritten scripts:
    http://gallery.technet.microsoft.com/scriptcenter
    If you can't find what you need and you can't write your own, you can request a script here:
    http://gallery.technet.microsoft.com/scriptcenter/site/requests
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • WMI Script resume a suspended messag

    Hi All,
    Can anyone help me with a WMI script to resume a suspended message (resumable) for a messaging instance of a particular receive port.

    Hi,
    You could use the following code from MSDN Resuming Suspended Service Instances of a Specific Orchestration Using WMI:
    using System.Management;
            public
    void ResumeSvcInstByOrchestrationName(string strOrchestrationName)
    try
    const uint SERVICE_CLASS_ORCHESTRATION = 1;
    const uint SERVICE_STATUS_SUSPENDED_RESUMABLE = 4;
    const uint REGULAR_RESUME_MODE = 1;
    // Query for suspended (resumable) service instances of the specified orchestration
    // Suggestion: Similar queries can be written for Suspend/Terminate operations by using different ServiceStatus value. See MOF definition for details.
    string strWQL = string.Format(
    "SELECT * FROM MSBTS_ServiceInstance WHERE ServiceClass = {0} AND ServiceStatus = {1} AND ServiceName = \"{2}\"",
                        SERVICE_CLASS_ORCHESTRATION.ToString(), SERVICE_STATUS_SUSPENDED_RESUMABLE.ToString(), strOrchestrationName);
                    ManagementObjectSearcher searcherServiceInstance =
    new ManagementObjectSearcher (new ManagementScope ("root\\MicrosoftBizTalkServer"),
    new WqlObjectQuery(strWQL),
    null);
    int nNumSvcInstFound = searcherServiceInstance.Get().Count;
    // If we found any
    if ( nNumSvcInstFound > 0 )
    // Construct ID arrays to be passed into ResumeServiceInstancesByID() method
    string[] InstIdList = new
    string[nNumSvcInstFound];
    string[] ClassIdList = new
    string[nNumSvcInstFound];
    string[] TypeIdList = new
    string[nNumSvcInstFound];
    string strHost = string.Empty;
    string strReport = string.Empty;
    int i = 0;
    foreach ( ManagementObject objServiceInstance
    in searcherServiceInstance.Get() )
    // It is safe to assume that all service instances belong to a single Host.
    if ( strHost == string.Empty )
                                strHost = objServiceInstance["HostName"].ToString();
                            ClassIdList[i] = objServiceInstance["ServiceClassId"].ToString();
                            TypeIdList[i]  = objServiceInstance["ServiceTypeId"].ToString();
                            InstIdList[i]  = objServiceInstance["InstanceID"].ToString();
                            strReport +=
    string.Format(" {0}\n", objServiceInstance["InstanceID"].ToString());
                            i++;
    // Load the MSBTS_HostQueue with Host name and invoke the "ResumeServiceInstancesByID" method
    string strHostQueueFullPath =
    string.Format("root\\MicrosoftBizTalkServer:MSBTS_HostQueue.HostName=\"{0}\"", strHost);
                        ManagementObject objHostQueue =
    new ManagementObject(strHostQueueFullPath);
    // Note: The ResumeServiceInstanceByID() method processes at most 2047 service instances with each call.
    // If you are dealing with larger number of service instances, this script needs to be modified to break down the
    // service instances into multiple batches.
                        objHostQueue.InvokeMethod("ResumeServiceInstancesByID",
    new object[] {ClassIdList, TypeIdList, InstIdList, REGULAR_RESUME_MODE}
                        Console.WriteLine(
    string.Format("Service instances with the following service instance IDs have been resumed:\n{0}", strReport) );
    else
                        System.Console.WriteLine(string.Format("There is no suspended
    (resumable) service instance found for orchestration '{0}'.", strOrchestrationName));
    catch(Exception excep)
                    Console.WriteLine("Error: " + excep.Message);
    [VBScript]
    ' wbemChangeFlagEnum Setting
    const REGULAR_RESUME_MODE = 1
    'Module to Resume service instances
    Sub ResumeServiceInstance(strOrchestrationName)
       Dim objLocator : Set objLocator = CreateObject("WbemScripting.SWbemLocator")
       Dim objServices : Set objServices = objLocator.ConnectServer(,
    "root/MicrosoftBizTalkServer")
       Dim strQueryString
       Dim objQueue
       Dim svcInsts
       Dim count
       Dim inst
       '=============================
       ' Resume service instances
       '=============================
       wscript.Echo "Bulk Resuming service instances - "
       Wscript.Echo ""
       On Error Resume Next
       ' Query for suspended (resumable) service instances of the specified orchestration
       ' Suggestion: Similar queries can be written
    for Suspend/Terminate operations by using different ServiceStatus value.  See MOF definition
    for details.
       set svcInsts = objServices.ExecQuery("Select * from MSBTS_ServiceInstance where ServiceClass = 1 AND ServiceStatus = 4 AND ServiceName = """
    & strOrchestrationName & """")
       count = svcInsts.count
       If ( count > 0 ) Then
          Dim strHostName
          Dim aryClassIDs()
          Dim aryTypeIDs()
          Dim aryInstanceIDs()
          redim aryClassIDs(count-1)
          redim aryTypeIDs(count-1)
          redim aryInstanceIDs(count-1)
          ' Enumerate the ServiceInstance classes to construct ID arrays to be passed into ResumeServiceInstancesByID() method
          Dim i : i= 0
          For each inst in svcInsts
             strHostName = inst.Properties_("HostName")
             aryClassIDs(i) = inst.Properties_("ServiceClassId")
             aryTypeIDs(i) = inst.Properties_("ServiceTypeId")
             aryInstanceIDs(i) = inst.Properties_("InstanceId")
             i = i + 1
          Next
          wscript.Echo "Total instances found during enumeration: " & i
          wscript.Echo " "
          'Get the HostQueue instance
          strQueryString = "MSBTS_HostQueue.HostName=""" & strHostName &
          set objQueue = objServices.Get(strQueryString)
          CheckWMIError
          'Execute the Resume method of the HostQueue instance
          ' Note: The ResumeServiceInstanceByID() method processes at most 2047 service instances with each call.
          '   If you are dealing with larger number of service instances,
    this script needs to be modified to
    break down the
          '   service instances into multiple batches.
          objQueue.ResumeServiceInstancesByID aryClassIDs, aryTypeIDs, aryInstanceIDs, REGULAR_RESUME_MODE
          CheckWMIError
          Wscript.Echo ""
          wscript.Echo "Instances resumed - " &  i &
       Else
          wscript.echo "There is no suspended (resumable) service instance found for orchestration '" & strOrchestrationName &
       End If
       Set objLocator = Nothing
       Set objServices = Nothing
       Set objQueue = Nothing
       On Error Goto 0
    End Sub
    'This subroutine deals with all errors using the WbemScripting object.  Error descriptions
    'are returned to the user by printing to the console.
    Sub   CheckWMIError()
       If Err <> 0   Then
          On Error Resume   Next
          Dim strErrDesc: strErrDesc = Err.Description
          Dim ErrNum: ErrNum = Err.Number
          Dim WMIError : Set WMIError = CreateObject("WbemScripting.SwbemLastError")
          If ( TypeName(WMIError) =
    "Empty" ) Then
             wscript.echo strErrDesc &
    " (HRESULT: "   & Hex(ErrNum) &
          Else
             wscript.echo WMIError.Description &
    "(HRESULT: " & Hex(ErrNum) &
             Set WMIError = nothing
          End   If
          wscript.quit 0
       End If
    End Sub
    HTH
    Steef-Jan Wiggers
    Ordina ICT B.V. | MVP & MCTS BizTalk Server 2010
    http://soa-thoughts.blogspot.com/
    | @SteefJan
    If this answers your question please mark it accordingly
    BizTalk

  • WMI scripts are not running on Windows 8.1

    Hi, I am using the below JavaScript to get the client IP and mac address in my application:
    function getIP() {
        var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}");
        e = new Enumerator(wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"));
        for (; !e.atEnd(); e.moveNext()) {
            var s = e.item();
    alert('Mac: ' + s.MACAddress + ' IP: ' + s.IPAddress(0));
     This java script is working fine on Windows XP/7/2008R2, but not on Windows 8.1.
    On Windows 8.1, the below script throws error:
    var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}");
    Line: 10
    Error:'GetObject' is undefined 
    I am using Lenovo ThinkPad to test this script, below are the system details:
    Windows Edition: Windows 8.1
    Processor: Intel(R) Atom ™ CPU Z2760 @ 1.80 GHZ
    Installed Memory (RAM): 2GB
    System Type: 32-bit Operating System, x86-based processor
    Pen and Touch: Full Windows Touch Support with 5 touch points
    Production ID: 00179-60394-05138-AAOEM
    About Internet Explorer:
    Version: 11.0.9600.17105
    Update Versions: 11.0.7 (KB2964358)
    Product ID: 00150-20000-00003-AA459
    Please help me it is really very urgent.

    Hi,
    I am afraid GetObject function in JavaScript is not supported in IE9 or later, see:
    GetObject Function (JavaScript):(This function is not supported in Internet Explorer 9 (standards mode) or later.)
    And regarding the scripts modification, we'd better seek help in the scripting guys forum for a better assistance:
    The offical scripting guys forum!
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Best regards
    Michael Shao
    TechNet Community Support

  • Powershell script to help fix broken WMI on remote servers/computer.

    I have a number of servers/computers that I am not able to update due to broken WMI. Does anyone out there have a Powershell script that will stop the WMI service, rename the repository and logs folders, then restart the WMI service again?
    I created a script to stop the service, but it will not allow me to rename the folders (tells me access denied). If I dameware into the pc and log in with my admin credentials I have no issues manually doing the above steps, but there has to be an easier
    way!
    Any help would be greatly appreciated.

    To remotely rename folders you must use an admin account on the remote system. The folder must not be protected the system and you cannot us WMI to rename the folder.
    You may have to restart the system after setting WMI to manual start as it can have locks and it may not shutdown cleanly.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • Eror: RSA premaster secret error on JDK 1.5.0_07-b03, Solaris platform

    I have received error "[javax.net.ssl.SSLKeyException: RSA premaster secret error] caused by [java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/PKCS1Padding]" when running the following code snippet from command line

  • NoClassDefFoundError during deployment & accessing EJBs in ear

    Platform - Redhat Linux 7.2 weblogic6.0 ant 1.3 for compilation and creation of ear. I get a NoClassDefFoundError when I try to access some of the EJBs in my deployed ear file. Previously, I faced a NoClassDefFoundError problem in deployment and I pu

  • First day owning Macbook. Major Boot up issues.

    I just bought my macbook today and I think I'm the only one who can manage to break it this quickly. Anyway I was installing office when the macbook crashed and told me I needed to reset or restart. At first it would boot up and then give me an error

  • Can i use a usb like 3g usb on the airpot

    Can i use a usb internet to connect two laptops at once through a 3g usb or a usb system thats found in africa juz plug and use but can use it on airport exterme and then connect two laptops at once and even tke out the usb and crry it around when i

  • Is there a way to use more than one column in sorting?

    I'm sorting my CDs by "Grouping", thus I have all my Christmas CDs together, all my Pop, all my Dance, etc. Only problem is that within those groupings the CDs aren't listed alphabetically. I'd like to have, for example, all my Christmas CDs grouped