powershell-2.0

Picking file names out of a website to download in powershell

时光毁灭记忆、已成空白 提交于 2019-12-31 07:33:07
问题 Problem: I'm working on making a PowerShell script that will download the sites source code, find all the file targets, and then download said targets. I'm alright for authentication for the moment, so on my test website, I enabled anonymous authentication, enabled directory browsing, and disabled all other default pages, so all I get is a list of files on my site. What I have so far is this: $source = "http://testsite/testfolder/" $webclient = New-Object system.net.webclient $destination =

how to retrieve memory type ( rdimm or udimm)?

做~自己de王妃 提交于 2019-12-31 01:54:06
问题 is there a way to know if installed memory is Registered DIMM or Unregistered DIMM ? the win32_physicalMemory doesn't seem to provide this info ? you can find more info about udimm rdimm here EDIT : the solution provided by @C.B doesnt work either 回答1: The first idea is using WMI Win32_PhysicalMemory and test if TotalWidth (bit count including check bits) is greater than DataWidth (bit count excluding check bits). gwmi Win32_PhysicalMemory | select totalwidth, datawidth, banklabel | % { if (

How can I t4 scaffold from powershell.exe?

心不动则不痛 提交于 2019-12-30 11:54:06
问题 NuGet's PM console is great and all but you have to be in Visual Studio to use it. I have asked this question before without any ansewr and I find it hard to believe there is no documentation on the topic. I have two users: User A sell shoes, User B sells cars. Each have different property needs. If I allow them to write there needed properties/datatypes to their respective Product.cs entity, how can I use PowerShell.exe to: Scaffold the controller, views, dbcontext and repositories? I know I

Powershell: How to use Format-Table with XML data

流过昼夜 提交于 2019-12-30 04:48:07
问题 <tickets type="array"> <ticket> <assigned-user-id type="integer">123</assigned-user-id> <closed type="boolean">true</closed> <creator-id type="integer">177522</creator-id> <number type="integer">306</number> <state>resolved</state> <tag nil="true"/> <title> title text 1 </title> <updated-at type="datetime">2012-03-14T13:13:11+11:00</updated-at> <user-id type="integer">96438</user-id> <version type="integer">3</version> <user-name>Username</user-name> </ticket> </tickets> I am a Powershell

Powershell/C#: Invoking a pipeline asynchronously & displaying the results

久未见 提交于 2019-12-29 09:34:15
问题 As per this sample - http://msdn.microsoft.com/en-us/library/windows/desktop/ee706590(v=vs.85).aspx, I am trying to invoke my script in an async way. But, at the same time, I want to give feedback to the GUI on the set of operations happening i.e. want to spit the Write-verbose stuffs happening behind the scenes parallely on the GUI. I am confused in achieving this - because I see there is a DataReady event on the PipelineReader object ? Is it possible to somehow consume that w.r.t the MSDN

Renaming Files with PowerShell

我只是一个虾纸丫 提交于 2019-12-29 09:22:19
问题 I need to rename a bunch of files at once in Windows PowerShell. I read the HTG article here and it helped a little. My problem is that It will only rename files in the top of the directory, nothing deeper. For example: There is FOLDER A and inside FOLDERA is a document and FOLDER B. Inside FOLDER B is another document. Both folders and both documents need to be renamed. The way it is working now is that FOLDER A, the document in FOLDER A, and FOLDER B are being renamed, but not the document

Does powershell remoting support version of the powershell to be used on remote target?

徘徊边缘 提交于 2019-12-29 08:25:09
问题 Can I supply a version of powershell to be used on the target machine while ps remoting. May be my question is not proper or not possible to answer but if any body having idea please help me. I am trying to do a remoting using powershell on a machine where powershell 2.0 3.0 and 4.0 versions are available , but I want to use the version 4.0 only (on target machine) is it possible? Thanks Gyan 回答1: Yes, there is a way to connect to a specific version of Powershell on a remote machine. It does

New-PSDrive does not support credentials?

非 Y 不嫁゛ 提交于 2019-12-29 07:40:07
问题 I am trying to map a drive in PowerShell 2.0 and getting this error? New-PSDrive –Name ftp –PSProvider FileSystem –Root “\\server\folder” -Credential $credential The provider does not support the use of credentials. Perform the operation again without specifying credentials. However, Get-Help New-PSDrive shows -Credential as a valid option? Is this a version issue in PS? Is there an alternative way to do the same...I would prefer to keep this within PS (since the drive is PS only then) and

Compare-Object not working if I don't list the properties

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-28 18:12:12
问题 I have 2 Excel spreadsheets I am trying to compare: $OleDbAdapter = New-Object System.Data.OleDb.OleDbDataAdapter “Select * from [Report$]“,”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:\FIS-BIC Reporting\Report Output Files\Product-Marketing\TEST_XI\ECM - Pipeline by LOB_04182013_040544.xls;Extended Properties=”"Excel 12.0 Xml;HDR=YES”";” $RowsReturned = $OleDbAdapter.Fill($DataTable) $OleDbAdapter2 = New-Object System.Data.OleDb.OleDbDataAdapter “Select * from [Report$]“,”Provider

Hashtables and key order

落爺英雄遲暮 提交于 2019-12-28 13:40:50
问题 Is there a way to keep the order of keys in a hashtable as they were added? Like a push/pop mechanism. Example: $hashtable = @{} $hashtable.Add("Switzerland", "Bern") $hashtable.Add("Spain", "Madrid") $hashtable.Add("Italy", "Rome") $hashtable.Add("Germany", "Berlin") $hashtable I want to retain the order in which I've added the elements to the hashtable. 回答1: There is no built-in solution in PowerShell V1 / V2. You will want to use the .NET System.Collections.Specialized.OrderedDictionary: