powershell

Fliter results of gci with strings from a textfile in Powershell

那年仲夏 提交于 2021-01-27 17:42:45
问题 After having ripped all my mother's DVD library to a Drobo-FS I setup for her, she was faced with the problem that having so many choices just a mouse-click away from made it too hard to choose. My solution was a Powershell script that starts playing a random movie: $files = Get-Childitem -Recurse -Path "\\DROBO-FS\Videos\Movies" -include *.mkv,*.avi,*.mp4,*.m4v $ran = Get-Random -minimum 0 -maximum ($files.length - 1) $movie = $files[$ran] & "C:\Program Files (x86)\MPC-HC\mpc-hc.exe" $movie

Login to Power BI with Power shell throws error “System.Net.WebException: The remote name could not be resolved: 'localhost.fiddler'”

泪湿孤枕 提交于 2021-01-27 17:33:35
问题 When I'm trying to login to Power BI with Microsoft Power Shell ISE : Login-PowerBI from the Package: MicrosoftPowerBIMgmt, I'm getting the following error: Failed to get ADAL token: Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The r emote name could not be resolved: 'localhost.fiddler' at System.Net.HttpWebRequest.EndGetResponse... 回答1: I had a

Powershell New-PSDrive Persist Between Login

余生长醉 提交于 2021-01-27 17:26:42
问题 I am using New-PSDrive to map network drives. My issue is that despite using the -Persist and -Scope Global parameters the drives no longer show up at the next Windows login for the user. The drives require credentials to access which I pass into the New-PSDrive command. I can see that the drives still exist after a logout and login by using net use at the command line, but the drives are not available. I believe what might be occurring is that Windows does not store the credentials and

How to find PC from list of users

。_饼干妹妹 提交于 2021-01-27 17:22:41
问题 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

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

Powershell New-PSDrive Persist Between Login

大兔子大兔子 提交于 2021-01-27 17:17:32
问题 I am using New-PSDrive to map network drives. My issue is that despite using the -Persist and -Scope Global parameters the drives no longer show up at the next Windows login for the user. The drives require credentials to access which I pass into the New-PSDrive command. I can see that the drives still exist after a logout and login by using net use at the command line, but the drives are not available. I believe what might be occurring is that Windows does not store the credentials and

Import list of users - Export List of users and Groups

依然范特西╮ 提交于 2021-01-27 17:11:31
问题 Is there any way I can import a list of users, get their groups in AD and export the list? Import-Csv C:\Users.csv | % {Get-AdUser -filter "displayname -eq '$($_.username)'"} | Get-ADprincipalGroupMembership | Select samaccountname, name | Export-csv -path C:\UserPermiss.csv -NoTypeInformation File example: username Jon Jo Steve Price Alan Partridge Cheers. 回答1: In PSv4+ you can leverage the -PipelineVariable / -pv common parameter to make the output of an earlier pipeline stage available to

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

Start PowerShell with -NoExit not working

杀马特。学长 韩版系。学妹 提交于 2021-01-27 15:06:28
问题 Need to launch several jobs in PowerShell, but they should be in different sessions. So to launch one, one could use: Start-Process powershell -ArgumentList "-command &{Get-Process}","-noexit","-noprofile" But the new window closes as soon as the command finishes. Even though I'm using -NoExit parameter. Acording to this article and this question, this should work. Even tried to block the window, by waiting for an user input, but it just closes. 回答1: While the command parameters are named,

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