PowerShell in Intune - How to Copy file(s) (1/3)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024
  • In this short video series about three different ways of using PowerShell in Intune, we start with how to copy file(s) by using PowerShell copy files bundled up in a Win32 app (.intunewin file).
    To see the whole series check here: • Intune - Three ways of...
    Links:
    Microsoft Win32 Content Prep Tool github.com/Mic...
    Script:
    Copy CMtrace file into c:\program files\CMtrace
    author: John Bryntze
    date: 18th October 2022
    Variables
    $JBNScriptRoot = Split-Path -Path $MyInvocation.MyCommand.Path
    $JBNCMtraceDir = "c:\program files\CMtrace"
    if(!(test-path -Path $JBNCMtraceDir))
    {
    New-Item -ItemType Directory -Path $JBNCMtraceDir
    }
    copy-item $JBNScriptRoot\CMTrace.exe -Destination $JBNCMtraceDir

ความคิดเห็น • 60

  • @user-do6fb6cy7t
    @user-do6fb6cy7t ปีที่แล้ว +4

    I am a sysadmin and I must say this is an excellent tutorial on TH-cam, Big thanks and please keep making more video like this!

  • @rashkaViking
    @rashkaViking ปีที่แล้ว +3

    Hi Sir!
    Once again, good content and explained easily. I always learn new things from your tutorials.
    Keep the good job!

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Thanks @Abdirashid Muhammed for that comment, makes me happy to hear, and the purpose of these videos.

  • @tyleroconnellt
    @tyleroconnellt ปีที่แล้ว +2

    The faster the better! :) Thank you for creating this videos, they are perfect! :)

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Thank you so much for this nice comment, more videos are coming :)

  • @shankhan-xm1yp
    @shankhan-xm1yp 2 หลายเดือนก่อน +1

    Hi another great video. Could you please do one video on network printer deployment through powershell in intune.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  2 หลายเดือนก่อน

      Thanks! would that be printers on-prem, such as \\server\print01 installation?

  • @SalissouMayanaAbdoulAziz
    @SalissouMayanaAbdoulAziz 9 หลายเดือนก่อน +2

    Excellent video.... Thanks a lot!

  • @evanwolliston5791
    @evanwolliston5791 3 หลายเดือนก่อน +2

    Awesome tutorial. Thanks.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  3 หลายเดือนก่อน

      Thanks a lot, love to read comments like this one, thanks again

  • @sangoku2007
    @sangoku2007 ปีที่แล้ว +1

    Thank you very much! Great! I only adapted the copy to environment variables.

  • @3143iamsam
    @3143iamsam ปีที่แล้ว +1

    As always great content John! Thank you!

  • @Andy_h123
    @Andy_h123 ปีที่แล้ว +1

    Thank you so much for responding to my comment and creating this video.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      @Aniket Chavda, cool you noticed and good question, happy it could be answered with a video :) CMTrace is nearly a must for us who troubleshoot and read Intune logs, thanks a lot for your comment

  • @ibrahimabdeltawab6418
    @ibrahimabdeltawab6418 ปีที่แล้ว +1

    It’s so informative! Thanks so much

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      Thanks you so much for your comment Ibrahim, happy it helps

  • @adkhan123456
    @adkhan123456 ปีที่แล้ว +1

    Love this video !!. Thanks.

  • @XwolfBane18
    @XwolfBane18 ปีที่แล้ว +1

    Great video will follow along on my own intune tenant :)

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Thanks a lot, so cool you got your own Intune tenant and can follow along :)

  • @ashwinikumarsccm307
    @ashwinikumarsccm307 11 หลายเดือนก่อน +2

    Very good video

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  11 หลายเดือนก่อน +1

      Thanks a lot Ashwini for taking time to comment

  • @ecuasteelo
    @ecuasteelo ปีที่แล้ว +1

    Great video thank you. Question, how do you become aware of all the features available for Intune and products. Are there some resources that you are able to share that I can reference?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Hi Steevo! thank you so much, some I find while doing my work, which I like the most since I know those could be useful for others. Then I always check what is new in Intune (also a link there showing what is in Development) to follow and see what is coming :)
      learn.microsoft.com/en-us/mem/intune/fundamentals/whats-new

    • @ecuasteelo
      @ecuasteelo 11 หลายเดือนก่อน +1

      @@IntuneVitaDoctrina Thank you for sharing. I'm always amazed on how you and other content creators in this space are always quick to new features that are released and create content for it immediately. Much appreciated.

  • @TanuchiSacin
    @TanuchiSacin หลายเดือนก่อน +1

    I have a question.. is there a way to copy a file located in a Sharepoint hub?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  หลายเดือนก่อน

      since the script runs as SYSTEM it got no permission in SharePoint.
      Could be done without Win32 app, and do it only by script alone and use MS Graph to copy from SharePoint.
      You would need an access key and all that setup to use in the script and then use this MS Graph:
      learn.microsoft.com/en-us/graph/api/driveitem-copy?view=graph-rest-1.0&tabs=http

  • @texddiaz
    @texddiaz ปีที่แล้ว

    thanks for share !! :D

  • @JustFixItGoldCoast
    @JustFixItGoldCoast 9 หลายเดือนก่อน +1

    Did I miss the sfc video?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  9 หลายเดือนก่อน +1

      SFC /Scannow, the System File Checker is in the following video 2/3:
      th-cam.com/video/zzwirfPNZHw/w-d-xo.html&ab_channel=Intune%26VitaDoctrina
      We create a script that create a scheduled task that runs SFC on a regular basis

  • @vaigandlakiran
    @vaigandlakiran ปีที่แล้ว +1

    its easy to understand thank you for the excellent content. quick info. can we also deploy Multiple pdf file using Intune

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Yes you can! thanks for posting.
      You have to add all the PDFs in the package source and then change the command to copy all files instead.

    • @vaigandlakiran
      @vaigandlakiran ปีที่แล้ว +1

      @@IntuneVitaDoctrinaThank you I will try the scrip now.

    • @fedemazza9928
      @fedemazza9928 หลายเดือนก่อน +1

      @@IntuneVitaDoctrina
      Hello, your videos are very helpful to me, can I ask you what should be modified to copy everything that is in the source directory? Or, if not the other alternative, would it be like adding more files? Thank you very much from Argentina.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  หลายเดือนก่อน

      @@fedemazza9928 thank you so much (cool from Argentina, Messi land! :) ), if you wanted to copy ALL from the source directory, you can just change it to a wildcard, * or as you mentioned add one line per file. If you use wildcard it looks like this (but it will copy the ps1 file also, so if only images you can change to like *.png instead):
      $JBNScriptRoot = Split-Path -Path $MyInvocation.MyCommand.Path
      $JBNCMtraceDir = "C:\Program Files\CMtrace"
      if (!(Test-Path -Path $JBNCMtraceDir)) {
      New-Item -ItemType Directory -Path $JBNCMtraceDir
      }
      Copy-Item -Path "$JBNScriptRoot\*" -Destination $JBNCMtraceDir -Recurse

  • @kenlang930
    @kenlang930 ปีที่แล้ว +1

    If you needed to copy a file from a specific location on each InTune device, where would you store these files?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      Interesting, so you want to collect files FROM the Intune clients, so the opposite direction?
      You can run a PowerShell script that copy the file and then you need a storage, which is your question basically, you can store it on SharePoint Online as long as you give the script permission there, or Azure Storage.
      Could be a future video, but for now this link got solutions for it:
      www.systanddeploy.com/2021/02/intune-troubleshooting-collect-remotely.html

    • @kenlang930
      @kenlang930 ปีที่แล้ว +1

      @@IntuneVitaDoctrina I have an application that collects data from each device to a standard location on each device. Then I need to collect this data to run some reports. You had mentioned storing these files on SharePoint which looks to be to be the better option. I'll review your suggested video. And thanks!

  • @ml7137
    @ml7137 ปีที่แล้ว +1

    Hello, very nice tutorials. Is it possible to copy it directly in a directory without going in the company portal ?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Hi @M L, yes, so during Assignment, instead of choosing "Available for enrolled devices" (which goes to Company Portal) you add devices to "Required" and also click on it and hide notification, users are rarely interested in knowing those things.

    • @ml7137
      @ml7137 ปีที่แล้ว +1

      @@IntuneVitaDoctrina Ok thanks you i'm going to test it ;)

    • @ml7137
      @ml7137 ปีที่แล้ว +1

      @@IntuneVitaDoctrina very nice channel btw it helped me a lot during my practice ;)

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      very very happy to hear, thanks a lot :)

  • @crunchraven000
    @crunchraven000 ปีที่แล้ว +1

    is there anyway i can upload a .intunewin file to intune via a http call?i need to automate the procedure

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Not done it myself, but there are PowerShell cmdlets that does the upload automated, such as add-IntuneWin32app, and it has to be HTTP based. Need to include Authentication so probably pretty much to do, but possible, read here:
      github.com/MSEndpointMgr/IntuneWin32App

    • @crunchraven000
      @crunchraven000 ปีที่แล้ว +1

      @@IntuneVitaDoctrina thank you very much for your instant anwer..i have tried and succeeded the authentication, yet the only api tha i have found, expects json so i cannot upload an msi or .intunewin file to intune through http call..i dont know where to look

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      impressive work you have done, hat off, sorry I cannot help more.. yeah .intunewin file in json format is not possible ;)

  • @marvnl
    @marvnl ปีที่แล้ว +1

    Can you also make a video on how to deploy app using winget with powershell scripts? For me it is not working, but maybe it is not possible. I wrote a script that first downloads the latest winget if not installed already, then it installs an app with winget command in the script. Then I deployed it as win32 app (packaged only the ps1 script. But maybe I am missing something so I am wondering how you would do this. If it works, we can then simply install all apps on winget and update then with remediation scripts as well and the app ID for it would then always be the same between install en remediation. perfect automation I would say :)

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      Hi M. Dff, I got a video doing that already: th-cam.com/video/MnFL2FQLjp4/w-d-xo.html
      I use it a lot at my work.
      I already assume winget is on the device. A tricky part which is mention in the video I link is that SYSTEM (the account that Intune installs with) cannot find winget.exe by just simply call winget.exe, you must give the full path to it and since it got a version number you cannot hardcode it.
      If it is ONLY a PS1 script calling winget.exe you don't even have to package it as a win32 app (but you can do) I do a lot of updates with Proactive Remediation scripts (got a video about that also: th-cam.com/video/ea0g1Y1zaek/w-d-xo.html)
      long answer, but 100% you can Win32 app package just a PS1 script calling winget.exe and install :) (watch out for detection script as you will have to call winget.exe there also to verify if locally installed is same version as online winget version for it to be a success)

    • @marvnl
      @marvnl ปีที่แล้ว +1

      @@IntuneVitaDoctrina aah perfect!! Many thanks again ;). It worked for me!
      And now, here is another idea. I am still fighting with it a little, but say a users has a windows device swap, in the app store I want to let him select ''SwapLaptop export apps'' so in the background ''winget export -o %userprofile%\Desktop\MyApps.txt'' will run, and on the new laptop he selects in the appstore ''SwapLaptop Import apps'' so command ''winget import -i %userprofile%\Desktop\MyApps.txt'' runs and than the install command.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว +1

      I like that idea!
      You could also package all software in Win32 with winget in script, and then deploy to a user AzureAD group, and then add the user (not device) to the group of software user should have.
      Then when user get new device, since you target user the software will follow the user due to the group membership

    • @marvnl
      @marvnl ปีที่แล้ว +1

      @@IntuneVitaDoctrina no, I have setup standard / basic apps everyone should have and assigned it to all users (1400) and all the rest I made available in the company portal. Our company is just to dynamic for department groups. Only when sso apps licenses that are assigned to a user and a package is needed, then it will be assigned to the user, because he is a member of the license group.
      But the laptop swap app is cool for people that installed multiple apps from Company portal already, but have to swap their laptop for some reason. It saves a lot of time. They only have to manually set up the settings again.

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      Yeah you need to have three bases of software:
      1. The software you want everyone to have such as anitvirus, office, your communication tools, maybe 7-Zip etc..
      2. Based on job function (often department) and if you can group these users together with an attribute or script with logic and then deploy for example Sales tools to the sales teams etc..
      3. Software you cannot know who will need it or maybe even licensed software, put in Self Service/Company Portal and have as a la carte
      You seems to have more of group 1 and 3 so your idea makes a lot of sense

  • @mohammedtharwat2361
    @mohammedtharwat2361 ปีที่แล้ว +1

    and if i need to update an existing folder ? i have an existing folder and i need to update its content with a new files weekly , is this effective for my situation ?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      It would work, is it the best solution I'm not sure. You have to package in Win32 package with the files each time.
      So yes it works, you could also put a schedule task that runs on the devices and download through FTP or alike every week or from AzureAD storage... but yeah do PowerShell copy with Win32 works fine.

  • @MrArijitslg1
    @MrArijitslg1 ปีที่แล้ว +1

    I am not good in Powershell. So wanted to know if there is any reason why you used "-Path $MyInvocation.MyCommand.Path" instead of the actual path such as "c:\intunewin32\"? In what scenarios should we use this?

    • @IntuneVitaDoctrina
      @IntuneVitaDoctrina  ปีที่แล้ว

      @AriJandro very good question. The reason why using a relative path such as "-Path $MyInvocation.MyCommand.Path" is only because we later in the video deploy this with Intune in a .intunewin file and then it later be downloaded to clients through the cloud.. and there we do not know the path, it is where Intune cache it so we cannot hard code it, so we do a dynamic path, hope that makes sense