powershell-2.0

How to find PC from list of users

久未见 提交于 2021-01-27 17:21:59
问题 I need some help. I'm not so sure that this possible. I have list of samAccountName in .csv file, and from this I need to get their PC name and IP. I'm not so sure how to build script like this. 回答1: One way of doing this could be to loop through all computers in your environment and test each one. This of course will be SLOW There is no example of what your CSV file looks like in the question, but if it looks something like this: "SamAccountName","title" "jdoe","testuser" "rboizov","system

Create CSV file in each subdirectory of target directory

孤街醉人 提交于 2021-01-27 15:08:36
问题 I have folder with files as below: D:\TESzz\Background\BG_Flash-Zootopia-HD-Desktop-Wallpapers.jpg D:\TESzz\Background\BG_NimmHBD.jpg D:\TESzz\Background\BG_Note5.jpg D:\TESzz\Icons\150x150.jpg D:\TESzz\Icons\Bathroom-gender-sign.png D:\TESzz\Icons\brocoli.png D:\TESzz\Icons\Carrot_Clipart_PNG_Image.png D:\TESzz\Icons\File.txt D:\TESzz\Icons\garlic.png D:\TESzz\Icons\ICONS.txt D:\TESzz\Icons\NoppNimm-1.jpg D:\TESzz\Icons\NoppNimmIcon.jpg D:\TESzz\Icons\NoppNimmIcon.png D:\TESzz\Icons

Refreshing Excel Sheets using powershell

不问归期 提交于 2021-01-27 15:01:29
问题 I have 10 excel different excel sheet in one folder named test. I want to refresh the data connection and data in the pivot table using windows power shell script. The process is using for each loop open each file and then in the file choose powerpivot menu refresh all data there which will refresh the OLEDB and OLAP query and then close that page and go to the data tab and click on the refresh all button and after refreshing work book in each excel sheets there are 5 sheets in 4 out of 5

Refreshing Excel Sheets using powershell

旧巷老猫 提交于 2021-01-27 14:39:46
问题 I have 10 excel different excel sheet in one folder named test. I want to refresh the data connection and data in the pivot table using windows power shell script. The process is using for each loop open each file and then in the file choose powerpivot menu refresh all data there which will refresh the OLEDB and OLAP query and then close that page and go to the data tab and click on the refresh all button and after refreshing work book in each excel sheets there are 5 sheets in 4 out of 5

Executing a scriptblock via startprocess

家住魔仙堡 提交于 2021-01-27 14:23:30
问题 Would any of you possibly know why this is not working? Start-Process $PSHOME\powershell.exe -ArgumentList "-NoExit -Command & `"{$outvar1 = 4+4; `"out: $outvar1`"}`"" -Wait The ultimate purpose for this is so that i can run a script block as another user with the addition of the -Credential option. But i can not get this simple script block to work yet. Many thanks. Chris. 回答1: Here is somthing that is working: PS C:\> Start-Process $PSHOME\powershell.exe -ArgumentList "-NoExit","-Command `"

Copy a list of files to a directory

 ̄綄美尐妖づ 提交于 2020-12-29 03:06:32
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr

Copy a list of files to a directory

浪子不回头ぞ 提交于 2020-12-29 03:05:42
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr

Copy a list of files to a directory

旧巷老猫 提交于 2020-12-29 03:04:53
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr

Copy a list of files to a directory

六眼飞鱼酱① 提交于 2020-12-29 03:03:32
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr

Multiline comment in PowerShell

一笑奈何 提交于 2020-11-26 05:00:09
问题 Can we comment multiple lines together in PowerShell? I tried looking, but I didn't find any answer. It's quite irritating to comment each line manually if the script is too long. 回答1: In PowerShell v2 and newer, use the following syntax for the multiline comments: <# a b c #> 回答2: The multiline comment in PowerShell should work. If not, try this... # This is # a # multiline comment. or <# This does works for me. #> If it doesn't work, try to check if you have the correct version of