powershell-2.0

Powershell why popup window, how to stop it

旧城冷巷雨未停 提交于 2020-01-03 03:34:10
问题 Not sure why when I execute a Python tools like pip or nosetests inside powershell, a separate popup command line windows will show, execute my command, then disappeared. This is annoying because I can hardly see the executable output, especially the last few lines before the popup close. I assume there are some setting I can change to stop the popup? I am using Powershell 2.0 in Windows 7. 回答1: Powershell is not cmd.exe, and it has a different console interface. More than likely, your py

Powershell - Removing all duplicate entries

送分小仙女□ 提交于 2020-01-03 02:21:15
问题 I am trying to find a Powershell command line that will read in a text file remove all duplicated lines (2+) and retain none of the duplicated lines. I haven't been able to find an answer for my question anywhere on Stackoverflow nor anywhere else. Every example I have found so far only shows removing one and/or many of the duplicated lines and retaining one. Is this possible through Powershell 2.0? PowerShell Command Example: Get-Content "C:\Temp\OriginalFile.txt" | select -unique| Out-File

Powershell and Lotus Notes - How to extract user names with employees numbers?

女生的网名这么多〃 提交于 2020-01-03 00:41:23
问题 I have specific problem. I need to extract domain names from active directory and combine them with employees numbers which are in Lotus Notes. I get the domain names with Get-QADUser (snapin from quest.com), that was no problem, but how to get the employees numbers and combine them? Thank you Edit(18.5. 11:56): Now I'm using this script (posted by Christian) and I figured out how to get the name of LN database - right-click on DB in Lotus notes workspace, then application/properties. #

Quick way to convert CSV types to original types with PowerShell's Import-Csv cmdlet?

故事扮演 提交于 2020-01-02 08:57:28
问题 I'm using PowerShell v2 and have a custom type I've defined called Material using code like this: add-type @" public struct Material { public string BusinessUnit; public string Source; public string PrimarySource; public string LegacyMaterialNumber; } "@ ...and I've got a collection of objects of this type I'm writing to a CSV file using the Export-Csv cmdlet. That works fine and produces data with the original type specified like this: #TYPE Material BusinessUnit,Source,PrimarySource

Loading a .NET 4.0 beta2 assembly in PowerShell 2.0

强颜欢笑 提交于 2020-01-02 07:27:27
问题 I tried loading PresentationFramework.dll from .NET 4.0 beta2 in PowerShell v2.0. But it fails with the following error. PS C:\Windows\system32> [Reflection.Assembly]::LoadFile("C:\Windows\Microsoft.NET\Framework\v4.0.21006\WPF\PresentationF ramework.dll") Exception calling "LoadFile" with "1" argument(s): "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x8013101B)" At line:1 char:32 + [Reflection.Assembly]::LoadFile

How to hide tabs on Powershell GUI?

℡╲_俬逩灬. 提交于 2020-01-02 06:08:19
问题 Ok, I created a powershell script and I am trying to make the main interface use a tabbed layout. I got all functionality i want working except i want to hide the tabs up top and use the buttons on the side to switch tabs. I already successfully have the buttons on the side selecting the different tabs, but i can't figure out how to hide the tabs up top? Anyone have any way how to do this??? Picture Says It Best: References: http://msdn.microsoft.com/en-us/library/system.windows.forms.tabpage

How to hide tabs on Powershell GUI?

*爱你&永不变心* 提交于 2020-01-02 06:07:35
问题 Ok, I created a powershell script and I am trying to make the main interface use a tabbed layout. I got all functionality i want working except i want to hide the tabs up top and use the buttons on the side to switch tabs. I already successfully have the buttons on the side selecting the different tabs, but i can't figure out how to hide the tabs up top? Anyone have any way how to do this??? Picture Says It Best: References: http://msdn.microsoft.com/en-us/library/system.windows.forms.tabpage

How to know the active session counts for a particular website hosted in IIS using PowerShell

◇◆丶佛笑我妖孽 提交于 2020-01-02 05:46:24
问题 I asked a question about knowing the running session count in IIS. Get running session count from IIS for my hosted Asp.Net web site and I got the following powershell script Write-host Getting performance counters ... $perfCounterString = "\asp.net applications(__total__)\sessions active" $counter = get-counter -counter $perfCounterString $rawValue = $counter.CounterSamples[0].CookedValue write-host Session Count is $rawValue Rightnow this script is giving active session count for all

Loop through xml elements

十年热恋 提交于 2020-01-01 04:27:11
问题 I have the following: $aMyArray = $null [xml]$userfile = Get-Content C:\AppSense\Scripts\AmPolicyConversion\AM_dev.xml $i = 0 FOREACH ($j in $userfile.ChildNodes){ FOREACH($k in $j.DocumentElement) { } $i = $i + 1 } I am trying to figure out how to loop through each element within powershell. Then check for an attribute of SID on the element. If exists get attribute value and put that value into an object and for the same element grab second attribute DISPLAYNAME and place into same object.

How to pass array of arguments to Powershell commandline

流过昼夜 提交于 2020-01-01 04:16:14
问题 I am trying to pass array of arguments to powershell script file. I was trying to pass the commandline like this in command line. Powershell -file "InvokeBuildscript.ps1" "z:\" "Component1","component2" But it doesn't take the parameters it seems. What am i missing? how to pass array of arguments? 回答1: Short answer: More double quotes could help... suppose the script is "test.ps1" param( [Parameter(Mandatory=$False)] [string[]] $input_values=@() ) $PSBoundParameters Suppose would like to pass