Get-CimInstance works from S1 to S2 but not from S2 to S1
I am doing a simple command Get-CimInstance -ClassName Win32_OperatingSystem – ComputerNema S2 from S1 which is a Windows 2012 R2 server running PowerShell 4.0 It fails with an error message tellingme...
View ArticleReply To: Get-CimInstance works from S1 to S2 but not from S2 to S1
That usually means mutual authentication couldn't work. Are you able to Enter-PSSession from the one to the other?
View ArticleCommand line too long..
Hi all, Just wondering what technique I could use to shorten my command line other than using variables for each parameter.. e.g. Set-QADUser -Identity $_."Name" -UserPrincipalName...
View ArticleReply To: Command line too long..
I prefer to use splatting to keep that sort of long command readable: $params = @{ Identity = $_.Name UserPrincipalName = $_.UserPrincipalName Alias = $_.Alias DisplayName = $_.DisplayName FirstName =...
View ArticleReply To: Command line too long..
Thanks Dave, just what I was looking for… Are these hash tables?
View ArticleReply To: Command line too long..
Yep, $params is a hash table. When you splat a hashtable, its keys become the names of command Parameters, and its values are the arguments passed to those parameters. You can also do splatting with...
View ArticleReply To: Command line too long..
Thank you Dave. I will do some reading up on arrays as well.
View ArticleReply To: Hash Tables GetEnumerator method
Thanks for the reply Rich; I was working on a logging hash table and wasn't fully understanding my results with IDictionaryEnumerator until I reread the documentation (thus both the question and...
View Articleservice status using powershell
Hi, I have created a powershell script to retrive the Service status for list of computers but its only giving the first servive status. so kindly help me on this. my code is mention below....
View ArticleReply To: Get-CimInstance works from S1 to S2 but not from S2 to S1
Yes, I had already tried that. What I do not see is any way to pass credentials using the Get-CimInstance cmdlet.
View ArticleCapturing Write-Verbose/Error/Warning in Custom Cmdlets and saving in SQL
Hi I'm exploring Don Jones' PS best practices about output from scripts using CmdletBinding() and the various Write-Verbose, Write-Debug etc. I want to combine this with the use of Custom Modules, and...
View ArticleReply To: Get-CimInstance works from S1 to S2 but not from S2 to S1
You create a CimSession, and then pass that to the Get-CimInstance cmdlet. When you set up the session first, you get more options.
View ArticleReply To: service status using powershell
So do you want the spreadsheet to have information about every service on every computer? Or are you only looking for a particular service?
View ArticleReply To: DSC Compliance Server and LCM's reporting back
I read through the blog post. Good information. When I tried calling the Compliance server I ran into an Authorization problem. The answer to my problem was in a comment added at the end of the post....
View ArticleReply To: DSC Compliance Server and LCM's reporting back
My reply got cut off somehow (second to last paragraph)… I also had to enable anonymousAuthentication and disable windowsAuthentication in the web.config file of the Compliance service, which is how...
View ArticleReply To: Capturing Write-Verbose/Error/Warning in Custom Cmdlets and saving...
The only thing I can think of which meets the requirements you've listed would be to create a new instance of System.Management.Automation.PowerShell and run the scripts inside that. Then you can set...
View ArticleReply To: Help Simplifying Code
Argh. It was all working fine with the changes. I was working on another script and when I came back to this one I receive this: Index was outside the bounds of the array. At...
View ArticleReply To: Help Simplifying Code
I removed lines within the New-Object PsObject -Property @{ ….. the culprit was the loginName line. I have another .ps1 that references it's own $loginName variable. Could that have been gumming up...
View ArticleReply To: service status using powershell
Dave pretty much nails it. $service is a collection of services. To add a specific service, you'll have to first pick it out of the collection like so: # This is a Wmi query filter $service =...
View Article