Automatically clear the host window before running new command
Hello, Quite often, before I figure out the final script, I try many single commands in the console window. After a while the screen gets clumsy. I know the cls command is not a big deal but still it...
View ArticleReply To: Create new automation OLE object
Hello Tomasz, The New-Object cmdlet defaults to create an instance of the .NET Framework class specified. You'll need to tell it to create a COM object instead. $AB = New-Object -ComObject...
View ArticleReply To: Automatically clear the host window before running new command
Not really, no. I mean, I suppose you could do something along the lines of PSReadline and run a Clear-Host when you detect and end-of-line, but I'm not sure if you could get consistently good results...
View ArticleReply To: Automatically clear the host window before running new command
Tomasz, I would like to suggest to change how you create and debug scripts. If you always start to create your scripts in the PowerShell ISE instead of the plain console and can run your single...
View ArticleReply To: Checking services remotely question
Well, you guys are awesome. I gave it shot using Get-WmiObject with the win32_service class and it worked great. First I tried this: Get-WmiObject -Class win32_service -Filter "Name Like '*TSM*'"...
View ArticleReply To: Checking services remotely question
Oops, WMI filters use WQL and the wildcard character is percent (%), not asterick (*). So, it's actually: Get-WmiObject -Class win32_service -Filter "Name Like '%TSM%'" -ComputerName $Computer...
View ArticleReply To: Checking services remotely question
Some are still 2003 so once we get them upgraded I'll probably start using Get-CIMInstance, in the mean time i'll start using the correct wild card haha. Thanks again
View ArticleReply To: LOG for Copy-item
thanks, I try some scenarios and not capable use this examples I try something like $computer = Get-Content C:\temp\computer.txt foreach ($c in $computer) { if (Test-Connection -ComputerName $c...
View ArticleReply To: LOG for Copy-item
try -append to the out-file that should capture each computer
View ArticleReply To: Automatically clear the host window before running new command
Don, Thanks for the reply. I am almost there. I added the following code to my prompt fuction. cls $cmd = Get-History -Count 1 | Select -Property CommandLine $cmd = [string]$cmd.CommandLine...
View ArticleReply To: Automatically clear the host window before running new command
Daniel, Yes, I use this approach too depending on the task I am working on. The point is it does not prevent you from the clumsy console screen even in ISE editor. Thank you. Tomasz
View ArticleReply To: Can't export Get-ADUser results using Export-CSV
Thanks Robert, Yes, I did know about the format-right rule. I was just trying anything to get all of the data into one sheet so I could manipulate it in Excel for a one-off report which was needed in...
View ArticleDell Warranty Information
So sometime in the last month or two Dell has made changes to their API. I had been using a script posted to poshcode to gather warranty information on all our workstations but that no longer works....
View Articlewinrm g & e swithch diffrence
What is the diffrence between e(enumarate) & g (get)switch? "winrm e winrm/config/listener" & "winrm g winrm/config"
View ArticlexDnsServerAddress problem
Hi all I'am testing DSC and have encountered a weird problem(weird for me atleast) when I try to set a clients DNS servers. The setup DSC Pull server (Windows 2012) Client server ( Windows 2012 R2 )...
View ArticleReply To: Dell Warranty Information
Thanks Adnan, I tend to use get-member quite often when dealing with objects I am not familiar with. So in this case you would run the following to get more info about the xml object $xml | gm
View ArticleReply To: Dell Warranty Information
I look at it now and that would be the obvious thing to of tried. Since its XML for some reason i think that threw me off and i didn't think could try that. Going to try working with XML more as i do...
View ArticleReply To: winrm g & e swithch diffrence
winrm e winrm/config/listener – This is enumerates the winRM listeners and a new GPO source listener should be created automatically. winrm g winrm/config – This is giving you the configuration...
View ArticleReply To: Help with adding a script method (and quite possibly the code of...
The replace method should just work like: # Replace all example: # $SearchFor = "mydomain" $ReplaceWith = "stewartsshops" [string]$DN = "OU=bl1 1,OU=mydomain,OU=New Computers,DC=mydomain,DC=local." #...
View ArticleModule review
I've recently written a module that has a function to identify the VHD path of a given VM disk. The module is available at...
View Article