powershell-2.0

powershell: how to click a “submit type” input

℡╲_俬逩灬. 提交于 2019-12-01 09:22:07
used powershell to do web ui automation. came up an exception: invoke method failed, because [System.__ComObject] does not contain “click” method. can submit type input be clicked? i used getElementsByTagName getElementsByClassName getElementsByName , does not work. anyone can help me on this? powershell code is below: # open the specified web site and commit the key $ie = new-object -com "InternetExplorer.Application" $ie.navigate("http://gitlab.alibaba-inc.com/keys/new") $ie.visible = $true while($ie.busy) {sleep 1} $doc = $ie.document # commit the button $commit = $doc.getElementsByTagName(

is it possible to have a window to insert data made by powershell?

我的未来我决定 提交于 2019-12-01 08:34:53
when I announce my changes on a server i always use my xml file which is pretty big and I search for the right place of my content like servername , time , data and my name they are at a not so comfortable postion and I want to automate this a bit. Is it possible to have a "graphical interface" made by powershell like my paint work shows ? And than I insert my data into the 4 colums which are then placed at the right position. If it is possible, can someone give me the name of the cmdlet or whatever it is ? i will figure out how to use it then.. TechNet has a useful guide to create a simple

[System.Object[]] doesn't contain a methodnamed 'replace'

点点圈 提交于 2019-12-01 08:28:52
问题 The following is part of the file edit07.html: From $array I'm able to access the $empid = $user.employeeid and $seat = $user.Position . The part where is code breaks is $filecontent = $filecontent.replace($pattern01,$new01) This works on PowerShell version 3, but I get [System.Object[]] doesn't contain a methodnamed 'replace' when I run it with PowerShell version 2. edit07.html : </a></td> </tr> <tr> <td height=1></td> <td colspan=5></td> <td colspan=3 rowspan=4 align=left valign=top><a href

Powershell - How to invoke a checkbox windows with multiple choice

这一生的挚爱 提交于 2019-12-01 08:15:42
I've seach some way to invoke a windows with many checkbox. Depending on the checkbox checked, that will enable or disable so part of my script. I don't have any idea how to create the shape and how to set a "true/false" value in var to enable or disable portion of my script. Anyone know how to create that kind of windows checkbox ? This code ( made with the help of PrimalScript for building form code ) has 3 checkbox. Based on the status (checked or not) the listbox will be populated from the result of some commands. Copy, paste and play with it. function GenerateForm { [reflection.assembly]:

Powershell 2 and .NET: Optimize for extremely large hash tables?

流过昼夜 提交于 2019-12-01 07:05:46
问题 I am dabbling in Powershell and completely new to .NET. I am running a PS script that starts with an empty hash table. The hash table will grow to at least 15,000 to 20,000 entries. Keys of the hash table will be email addresses in string form, and values will be booleans. (I simply need to track whether or not I've seen an email address.) So far, I've been growing the hash table one entry at a time. I check to make sure the key-value pair doesn't already exist (PS will error on this

Mysterious different conversion to string[] of seemingly same input data

谁都会走 提交于 2019-12-01 06:29:13
问题 During investigation of some problem I found that the reason was unexpected different conversion to string[] of seemingly same input data. Namely, in the code below two commands both return the same two items File1.txt and File2.txt. But conversion to string[] gives different results, see the comments. Any ideas why is it? This might be a bug. If anybody also thinks so, I’ll submit it. But it would nice to understand what’s going on and avoid traps like that. # *** WARNING # *** Make sure you

IE Com Object, Difference between methods .Navigate and .Navigate2

浪尽此生 提交于 2019-12-01 06:22:23
What is the difference between $ie.Navigate("URL") and $ie.Navigate2("URL") ? Get-Member says: Navigate Method void Navigate (string, Variant, Variant, Variant, Variant) Navigate2 Method void Navigate2 (Variant, Variant, Variant, Variant, Variant) Sample Code: $ie = New-Object -ComObject InternetExplorer.Application $ie.visible = $true $ie.Navigate("www.stackoverflow.com") #or $ie.Navigate2("www.stackoverflow.com") The difference is in the first argument URL . Here is what MSDN says: Navigate Method URL: A String expression that evaluates to the URL, full path, or Universal Naming Convention

Powershell - How to invoke a checkbox windows with multiple choice

假装没事ソ 提交于 2019-12-01 06:11:50
问题 I've seach some way to invoke a windows with many checkbox. Depending on the checkbox checked, that will enable or disable so part of my script. I don't have any idea how to create the shape and how to set a "true/false" value in var to enable or disable portion of my script. Anyone know how to create that kind of windows checkbox ? 回答1: This code ( made with the help of PrimalScript for building form code ) has 3 checkbox. Based on the status (checked or not) the listbox will be populated

Powershell command through C# code

早过忘川 提交于 2019-12-01 06:04:53
问题 I want to add through C# code Powershell command or script (what is correct?) variable declaration with default value stored in C# variable. For example, in Powershell I typing following line $user = 'Admin' I want to add this line in C# code. powershell.AddScript(String.Format("$user = \"{0}\"", userName)); or powershell.AddCommand(String.Format("$user = \"{0}\"", userName)); I try with AddCommand() but it throws exception. I use PS 2.0. 回答1: According to this article How to run PowerShell

powershell: how to click a “submit type” input

爷,独闯天下 提交于 2019-12-01 05:46:31
问题 used powershell to do web ui automation. came up an exception: invoke method failed, because [System.__ComObject] does not contain “click” method. can submit type input be clicked? i used getElementsByTagName getElementsByClassName getElementsByName , does not work. anyone can help me on this? powershell code is below: # open the specified web site and commit the key $ie = new-object -com "InternetExplorer.Application" $ie.navigate("http://gitlab.alibaba-inc.com/keys/new") $ie.visible = $true