ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    MS AutoPilot Script: export to network share

    Scheduled Pinned Locked Moved IT Discussion
    2 Posts 1 Posters 107 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobseG
      gjacobse
      last edited by

      Until I can get a win on the ScriptExecution front, I've come up with a possible way to get a success on getting the needed information to onboard a device into AutoPilot.

      POWERSHELL Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -force
      Echo Setting ExecutionPolicy
      timeout 3 >nul
       
      POWERSHELL Install-Script -Name Get-WindowsAutoPilotInfo -force
      Echo Getting AutoPilotInfo
      timeout 20 >nul
       
      POWERSHELL Get-WindowsAutoPilotInfo -OutputFile "\\10.7.20.27\IT Resources\!!!_HWID_!!!\!AutoPilot!.csv" -append
      Echo Saving AutoPilot Info
      timeout 5 >nul
       
      pause
      

      Everything works - except the OutputFile, there are number of returned errors, the first being;

      New-CimSession : WS-Management could not connect to the specified destination.

      In talking with @EddieJennings, he suggested saving to the local computer and then copying to the network share. I think that is easily done - but I really wanted to append the file with results over having a single file for each computer.

      Of course - I could also go this route, and then merge all the files before importing them into the AutoPilot console.

      1 Reply Last reply Reply Quote 0
      • gjacobseG
        gjacobse
        last edited by gjacobse

        Updated Script - Which does work.

        @Echo Off
        Echo.
        Echo.
        POWERSHELL Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -force
        Echo Setting ExecutionPolicy
        timeout 2 >nul
         
        POWERSHELL Install-Script -Name Get-WindowsAutoPilotInfo -force
        Echo Getting AutoPilotInfo
        timeout 20 >nul
         
        POWERSHELL New-Item -Type Directory -Path "C:\HWID"
        POWERSHELL Set-Location -Path "C:\HWID"
        POWERSHELL Get-WindowsAutoPilotInfo -OutputFile "C:\HWID\AutoPilot_HWID-%computername%.csv"
        Echo Saving AutoPilot Info
        timeout 5 >nul
        Echo Copy to NAS
        xcopy "C:\HWID\AutoPilot_HWID-%computername%.csv" "\\10.7.20.27\IT Resources\!!!_HWID_!!!"
        rmdir /Q /S "C:\HWID"
        pause
        

        Added rmdir for clean up.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post