Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: import-module on remote computer problem

Thanks much. That did work to get the module to load and the script to run. Creating the credentials with Get-Credential requires hand-entering credentials which I don't want to do for this script. I...

View Article


Mandatory only in a specific parameterset

Let's say I have some params like this: [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$Param1, [Parameter(Mandatory)] [string]$Param2, [Parameter(ParameterSetName = 'Set1', [switch]$Param3,...

View Article


Reply To: Mandatory only in a specific parameterset

The main problem with your example is that you haven't defined a default parameter set, and PowerShell sometimes get confused there. If you add DefaultParameterSetName = 'AnyStringOtherThanSet1' to...

View Article

Reply To: Mandatory only in a specific parameterset

You can decorate the parameters like this function test {   [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$Param1,   [Parameter(Mandatory)] [string]$Param2,   [Parameter(ParameterSetName =...

View Article

Reply To: PS Web Access Book

Technically, PWA does go into the default Web site, but it doesn't go in the root folder. PSWA is a virtual folder added to the Default Web Site – although you can change that configuration when...

View Article


Reply To: Audio volume

Indeed, thanks for letting me know I just corrected the links in my post.

View Article

Hash Table

Heres my hash Table $h = [ordered]@{ Computername=$env:computername ServiceState = "wscsvc", "CcmExec" | foreach {Get-WmiObject -Class Win32_Service -Filter "Name = '$($_)'" | select Name, State }...

View Article

Reply To: Hash Table

That's how Powershell displays arrays and PSObjects as text. (Arrays go into a pair of curly braces with comma-separated values, and PSObjects are displayed like hashtable literals.) You can certainly...

View Article


Reply To: Mandatory only in a specific parameterset

Dave, I did try to add a default parameter set with no parameters in it as well but the same behavior persisted. However, you do have a point where I didn't even really need $Param3 at all. I removed...

View Article


Reply To: Hash Table

I'm not sure what you're doing with that hashtable. Here's a different approach which builds an array of objects, which are displayed in a more user-friendly way by Format-Table: $services = "wscsvc",...

View Article

Reply To: Hash Table

Hi Dave id like it to look like this if possible i would also like to export-csv to results I am remoting into 70 machines and building a report basec on 2 criteria state and startup mode Name State...

View Article

Reply To: Hash Table

That's easy enough, but you don't have ComputerName or StartMode in that output, both of which were part of your original code. Should they be there as well? (If so, use the code from my previous...

View Article

Reply To: Hash Table

actually your example is perfect thank you

View Article


Reply To: Managing Hostnames vs. GUIDs on a Pull Server

Is anyone having multiple servers pull the same GUID? Wouldn't doing so make it impossible to configure things like hostname and IP address with DSC? I'm just trying to figure out if there are any...

View Article

Reply To: Managing Hostnames vs. GUIDs on a Pull Server

Clint Armstrong wrote:Is anyone having multiple servers pull the same GUID? Wouldn't doing so make it impossible to configure things like hostname and IP address with DSC? I'm just trying to figure...

View Article


Reply To: Script to install .EXE and configure on remote machines

Hello Pandiyan, I would use Copy-Item to get the EXE onto the remote machine followed by Invoke-Command to run it with the silent parameters using Start-Process....

View Article

Reply To: Mandatory only in a specific parameterset

Adam, see if this helps, this is the param set I ended up with when doing my inactive computer script. I'm not a fan of the massive param set, but when I got done with the whole ordeal it produced...

View Article


Reply To: Formating output

Can you explain how you would like the list box to look? For instance, if you wanted something like this: $roles | foreach{$_.PSObject.Properties | foreach{"{0} ({1})" -f $_.Value, $_.Name}}...

View Article

Reply To: Formating output

I used to go back and forth with jvierra all of the time on http://www.visualbasicscript.com. He can be very abrupt, but he is a very intelligent person and I learned a lot about coding from him. Just...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Formating output

I know. It just pisses me off when his attitude is the first thing a forum newcomer sees, and they wind up leaving because of it. I wouldn't put up with that kind of thing on PowerShell.org, but as it...

View Article
Browsing all 13067 articles
Browse latest View live