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 ArticleMandatory 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply To: Audio volume
Indeed, thanks for letting me know I just corrected the links in my post.
View ArticleHash 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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