modifying an existing script Inventory script

Welcome Forums General PowerShell Q&A modifying an existing script Inventory script

Viewing 4 reply threads
  • Author
    Posts
    • #252020
      Participant
      Topics: 68
      Replies: 72
      Points: 544
      Rank: Major Contributor

      I am reaching out to look for ideas on how to customize a an existing PowerShell so the technicians can easily create and install either via on a single workstation or on a domain.

      The script uses basic ‘Get-wmiobject’ cmdlets and gathers PC information.  It will then create a custom object and then convert the output to a json file format and upload to our database via API.  The SiteID indicates which client this computer belongs to.

      My script will do a continual loop and once every 4 hours, run again and upload its data, which will reset a time field in our database which indicates when a machine ‘reported in’ last.

      Using PowerShell Studio, I converted my script with the hard set ‘SiteID’ to a service and installed it on few workstations at a small client office and it works.   The SiteID field will be custom for each site and I need to make this easy for technicians to install on workstations which some may still be running on PSversion 2 (Windows 7).

      This is my ideal scenario for what this would look for as the process a  technician would follow to create the executalbe to deploy to one of our clients.  The technician would just have to supply the SiteID number.

      Create-InventoryEXE – SiteID 10 -Name “BobsAutoInv”

      The output is an EXE or MSI  that can be run on a workstation or set to run as a GPO to run on an entire Domain.

      “BobAutoInv.msi”

      I am not committed to the idea that this HAS TO BE A SERVICE and to run this as a scheduled task. My thought is that services might be more easily monitored by our auditor where we can run a report on services running to see if this one is stopped, started, or even there.

      Wonder if anyone can give me general direction on how to:

      1. Hard code the SiteID without the technicians going into the code itself.
      2. Create the service from the script via command line.   Can this be done with a dotnet command/script?
      3. If a service is not a good idea, how to do this as a scheduled task, keeping in mind that older version of PowerShell might have to be contended with.

      Not looking for a line by line explanation.  I can do the learning and the research, but just point me in the direction of what I need to be looking at to accomplish this.

       

      • This topic was modified 3 months, 1 week ago by kvprasoon. Reason: code formating and title change
    • #252041
      Participant
      Topics: 68
      Replies: 72
      Points: 544
      Rank: Major Contributor
    • #261764
      Participant
      Topics: 0
      Replies: 1
      Points: 5
      Rank: Member

      does anyone have a working script for pulling inventory for domain computers, using text file for computers to scan and create .csv report?

    • #261908
      Participant
      Topics: 10
      Replies: 200
      Points: 982
      Helping Hand
      Rank: Major Contributor

      Can the SiteID be $ENV:UserDomain so you dont have to hard code?

    • #261920
      Participant
      Topics: 17
      Replies: 1951
      Points: 3,985
      Helping Hand
      Rank: Community Hero

      There are many Computer inventory scripts available in galleries and blogs. Have you searched for “powershell computer inventory script” ? I have about 834,000 results (0.48 seconds)

Viewing 4 reply threads
  • The topic ‘modifying an existing script Inventory script’ is closed to new replies.