Tagged Questions
0
votes
0answers
20 views
Running Remote Powershell Commandlet that wraps a process exits before completion
I have a custom PowerShell commandlet that I have created in C# that spins up some instances of vstest.console.exe and publishes the test results to a .trx file or to tfs.
This commandlet works in ...
1
vote
1answer
22 views
Clearing ISE Powershell environment / debugging methodology
When writing a powershell script in ISE I have something analogous to (which I execute with F5):
Function DoSomethingNow
{
"What am I doing?"
}
DoSomethingNow
The problem is if I rename or ...
0
votes
1answer
21 views
Passing DateTime as a parameter
I've read widely that I can pass in an argument to my powershell script via:
param (
[Datetime]$argument
)
I've also read that I can define a default value:
param (
[Datetime]$argument = ...
0
votes
1answer
23 views
How to print Exchange server name to screen for a given username
I am writing a script that takes username and find its mailbox server.
this is what I tried:
$mailboxDetails = get-mailbox -id MyUser
write-host $mailboxDetails
*MyUser is my username in AD
this ...
1
vote
0answers
16 views
Using AsyncCallback in Powershell
I have to call a method on .NET object which is defined as
IAsyncResult BeginListMetrics( ListMetricsRequest listMetricsRequest,
AsyncCallback callback, Object state )
Is it ...
0
votes
1answer
23 views
Performance counters not being written by Powershell job
I'm working on setting up a script that can be run from any Windows servers to gather some perfmon scripts in the background in a rolling log file. I could use the PerfMon GUI, but I figured this ...
0
votes
2answers
42 views
DownloadString with basic auth similar to psget's
Anyone know how I can modify the DownloadString below so I can pass basic auth credentials as well?
I am using the same technique used for PsGet (http://psget.net/) to download my own internal ...
0
votes
1answer
61 views
Illegal Chars in recursive Directory traversal
im trying to count the amount of files in folders recursivly on a mounted WebDav Drive.
Following Script works if there are no illegal Char's in Path or Filenames and like a Charm on my local Disk.
...
0
votes
1answer
55 views
PowerShell Get-DiskUsage CmdLet: how to list from a different drive/directory?
I'm a relative newbie on PowerShell, wanted to know a bit more about functions, CmdLet and human readable values. Usually for learning new things, looking at what others do works well.
So I went ...
3
votes
3answers
64 views
PSRemoting performance overhead with get-childItem
This completes in 2.3 minutes on LOCALSERVER:
A: measure-command {$x = invoke-command {gci -recurse "C:\"}}
This completes in 38.4 minutes on LOCALSERVER:
B: measure-command {$x = ...
0
votes
2answers
36 views
Storing a part of a json query result in a variable in powershell
I have the following output from a json query and I am looking for a way to search though it and pull the value for the tvdbid(the number 72663) and store it in a variable.
In the example below ...
1
vote
2answers
76 views
Get path to file that defines PowerShell function
I'm trying to figure out a way of getting the file path where a PowerShell function is defined (eg. Test1 or Test2), rather than the caller's path, which would be easily obtained via the $PSScriptRoot ...
2
votes
1answer
70 views
Import-GPO by using folders named after its DisplayName - Powershell
I am using a powershell script to import GPOs which I have saved as GUIDs (the default).
I wish to import the GPOs on a different system, the GPOs are saved to a CD at this point. So a simple way to ...
0
votes
2answers
53 views
TCP Chimney command via Powershell
I have the below that I have been trying to get to work but cannot at the moment. I want it to go through and get the output of netsh command but all I need are it to check three of the outputs.
Here ...
0
votes
1answer
56 views
Powershell Data.Table
Can anyone give some help with powershell tables?
The working part of the script
Function CheckWMI {
Param (
[Parameter(Mandatory=$True)]
$Computers
)
$CheckWMIResults = New-Object ...
1
vote
1answer
57 views
Powershell - Check for updates to script prior to running
I was wondering if anyone knew of a way to have a powershell script check for updates to itself prior to running.
I have a script that I am going to be dispatching out to multiple computers, and ...
0
votes
2answers
93 views
PowerShell replace multiple elements in text file depending on the contents
Thanks in advance for your time.
I'm new-ish to PowerShell, trying to write a script which can search through a bunch of text files and pick out certain elements, then use those to replace other ...
0
votes
1answer
82 views
My PowerShell script only works when running from ISE
I can't post all of the script contenet, but the basic idea is that it downloads JSON and converts it to objects using the ConvertFrom-Json cmdlet. Some objects are filtered out, and the rest are ...
0
votes
1answer
143 views
Powershell scheduled job will not start
The new scheduled jobs in powershell 3 look fantastic, but to my horror I am unable to get them to work.
Register-ScheduledJob -FilePath V:\scripts\testJob.ps1 -Name Test
$t = New-JobTrigger -At 6PM ...
0
votes
1answer
87 views
Why can't I get my modules to load from a directory in PSModulePath?
I'm trying to install a PS module so that it can be imported from anywhere. I've added my install directory to the environment variable and that didn't work, so I tried putting my module in the PSCX ...
0
votes
1answer
89 views
Restarting PC's and writing to the event log with a custom message
I have written a script in PowerShell that will remotely restart a list of PC's using the 'Restart-Computer' command.
Is there a way of adding a custom message to the systems event log, to explain ...
-1
votes
1answer
53 views
How to run the Konami code in Powershell?
I have created a Powershell script (GUI form) and I got all functionality i want working.
But I want to know if it is possible to run a Konami code into a Powershell script ?
If yes, could anyone ...
0
votes
1answer
128 views
Invoke-WebRequest GetSystemWebProxy()
Under PowerShell 2.0 I know that you can set the proxy you would like to use without knowing the exact proxy settings by doing something like the following:
$proxy = ...
0
votes
1answer
244 views
How to control tabpages with menu strip?
I have 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 ...
0
votes
2answers
171 views
Saving Excel File as XML with PowerShell
I'm currently writing a script in powershell that searches for XLS files recursivly through a file tree. I'd like to save all the files to xml to be able to read through them and change data as ...
2
votes
1answer
59 views
Can't run Powershell 64 on Core i7
I'm trying to get into Powershell Workflows, however I get the following error if I attempt to use the "workflow" keyword:
Windows PowerShell Workflow is not supported in a Windows PowerShell ...
2
votes
2answers
95 views
Start-Job passing XML object to -ArgumentList working different in Powershell V2 & V3
I'm testing a deployment script for my application on Windows Server 2012 with Powershell v3. The script runs fine on Win Server 2008 R2 and Win 7 with Powershell v2. The issue I'm running into now ...
0
votes
2answers
77 views
Json Encoding HTML string
I'm currently producing a JSON file from a PowerShell script but it is outputting Unicode instead of special characters such as '<' I need HTML in the LinkText but not sure how to change the ...
1
vote
1answer
66 views
ConvertTo-JSON not outputting correctly
I'm trying to use the ConvertTo-JSON method in Powershell to create a JSON result but my output that I'm getting is not valid JSON. A sample of my output is:
{
"label": "$stockShortName"
}
{
...
0
votes
2answers
69 views
Display all sites and bindings in powershell
I am documenting all the sites and binding related to the site from the IIS. Wondering if there is an easy way to get this list through powershell script rather than manually typing looking at IIS?
I ...