Тёмный

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

Intune & Vita Doctrina
Подписаться 4,9 тыс.
Просмотров 8 тыс.
50% 1

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

Опубликовано:

 

15 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 67   
@XianLi-m1z
@XianLi-m1z Год назад
I am a sysadmin and I must say this is an excellent tutorial on RU-vid, Big thanks and please keep making more video like this!
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks a lot Xian
@rashkaViking
@rashkaViking 2 года назад
Hi Sir! Once again, good content and explained easily. I always learn new things from your tutorials. Keep the good job!
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 года назад
Thanks @Abdirashid Muhammed for that comment, makes me happy to hear, and the purpose of these videos.
@SalissouMayanaAbdoulAziz
@SalissouMayanaAbdoulAziz 10 месяцев назад
Excellent video.... Thanks a lot!
@sangoku2007
@sangoku2007 Год назад
Thank you very much! Great! I only adapted the copy to environment variables.
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks a lot Rodrigo for your comment, well done!
@tyleroconnellt
@tyleroconnellt Год назад
The faster the better! :) Thank you for creating this videos, they are perfect! :)
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thank you so much for this nice comment, more videos are coming :)
@shankhan-xm1yp
@shankhan-xm1yp 3 месяца назад
Hi another great video. Could you please do one video on network printer deployment through powershell in intune.
@IntuneVitaDoctrina
@IntuneVitaDoctrina 3 месяца назад
Thanks! would that be printers on-prem, such as \\server\print01 installation?
@boyoscar10
@boyoscar10 10 дней назад
@shankhan-xm1yp That will be a good video for network printers. I'm been searching for that (add a printer from a printer server) but I been having a lot of issues trying to add one) Also, Here in our company already have some bat that install network printers but the hard part is that it always asked for admin credentials (install print driver)
@ibrahimabdeltawab6418
@ibrahimabdeltawab6418 Год назад
It’s so informative! Thanks so much
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks you so much for your comment Ibrahim, happy it helps
@evanwolliston5791
@evanwolliston5791 4 месяца назад
Awesome tutorial. Thanks.
@IntuneVitaDoctrina
@IntuneVitaDoctrina 4 месяца назад
Thanks a lot, love to read comments like this one, thanks again
@3143iamsam
@3143iamsam 2 года назад
As always great content John! Thank you!
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 года назад
Thanks a lot Mike for your support
@Andy_h123
@Andy_h123 2 года назад
Thank you so much for responding to my comment and creating this video.
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 года назад
@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
@ecuasteelo
@ecuasteelo Год назад
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 Год назад
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 Год назад
@@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.
@boyoscar10
@boyoscar10 11 дней назад
Hello!, Great video, i just have a question related with the Path where you want to copy the file or files. If this path needs to be copy in a User folder, Example: (C:\Users\X\Appdata\Roaming) where x is the name of the user, what is the best variable for that? and also in the detection rules?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 10 дней назад
Hi, that is an excellent question, since we are in Powershell lets use this one: $JBNRoamingAppData = [System.Environment]::GetFolderPath('ApplicationData') Then you have a variable that goes to C:\Users\X\Appdata\Roaming, just remember that now you must run the script as USER and NOT as SYSTEM, and you will be fine
@boyoscar10
@boyoscar10 8 дней назад
@@IntuneVitaDoctrina Can you show me an example (using the path that i showed you?)
@IntuneVitaDoctrina
@IntuneVitaDoctrina 8 дней назад
if the path is under Roaming, the user profile, maybe a sub folder called Microsoft or Office, then just append that to the variable $JBNRoamingAppData = [System.Environment]::GetFolderPath('ApplicationData') then the path to the place be $JBNRoamingAppData\Microsoft $JBNRoamingAppData\Office
@adkhan123456
@adkhan123456 Год назад
Love this video !!. Thanks.
@vaigandlakiran
@vaigandlakiran Год назад
its easy to understand thank you for the excellent content. quick info. can we also deploy Multiple pdf file using Intune
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
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 Год назад
@@IntuneVitaDoctrinaThank you I will try the scrip now.
@fedemazza9928
@fedemazza9928 2 месяца назад
@@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 2 месяца назад
@@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
@XwolfBane18
@XwolfBane18 2 года назад
Great video will follow along on my own intune tenant :)
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 года назад
Thanks a lot, so cool you got your own Intune tenant and can follow along :)
@ashwinikumarsccm307
@ashwinikumarsccm307 Год назад
Very good video
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
Thanks a lot Ashwini for taking time to comment
@TanuchiSacin
@TanuchiSacin 2 месяца назад
I have a question.. is there a way to copy a file located in a Sharepoint hub?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 2 месяца назад
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
@jojoka74
@jojoka74 14 дней назад
I got error when I install on computer from company portal. Where can I find error ?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 13 дней назад
Hi, sad to hear you getting errors, since we package this as a Win32 app, I would troubleshoot the logs for that, got a video for that also :) ru-vid.com/group/PL1JNh3sw_Qyd0tNx3zwXaG7LamwAvYv3N
@ml7137
@ml7137 Год назад
Hello, very nice tutorials. Is it possible to copy it directly in a directory without going in the company portal ?
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
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 Год назад
@@IntuneVitaDoctrina Ok thanks you i'm going to test it ;)
@ml7137
@ml7137 Год назад
@@IntuneVitaDoctrina very nice channel btw it helped me a lot during my practice ;)
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
very very happy to hear, thanks a lot :)
@kenlang930
@kenlang930 Год назад
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 Год назад
@@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!
@JustFixItGoldCoast
@JustFixItGoldCoast 11 месяцев назад
Did I miss the sfc video?
@IntuneVitaDoctrina
@IntuneVitaDoctrina 11 месяцев назад
SFC /Scannow, the System File Checker is in the following video 2/3: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-zzwirfPNZHw.html&ab_channel=Intune%26VitaDoctrina We create a script that create a scheduled task that runs SFC on a regular basis
@mohammedtharwat2361
@mohammedtharwat2361 Год назад
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.
@marvnl
@marvnl Год назад
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 Год назад
Hi M. Dff, I got a video doing that already: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-MnFL2FQLjp4.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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ea0g1Y1zaek.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 Год назад
@@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 Год назад
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 Год назад
@@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
@texddiaz
@texddiaz Год назад
thanks for share !! :D
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
thanks a lot Texy for all support!
@crunchraven000
@crunchraven000 Год назад
is there anyway i can upload a .intunewin file to intune via a http call?i need to automate the procedure
@IntuneVitaDoctrina
@IntuneVitaDoctrina Год назад
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 Год назад
@@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 ;)
@MrArijitslg1
@MrArijitslg1 Год назад
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
Далее
Слушали бы такое на повторе?
01:00
Copy, Move, Delete files with PowerShell
17:01
Просмотров 173 тыс.
Intune Proactive Remediations + Winget.exe = Love
41:25
Deploying apps via Intune? Do this!
18:43
Просмотров 74 тыс.
Should You Install Software Using .EXE or .MSI ?
10:15
Просмотров 566 тыс.
How To Deploy Win32 Applications in Microsoft Intune
21:10
Learn PowerShell in Less Than 2 Hours
1:48:21
Просмотров 292 тыс.