Reply To: Blank entry in hash table or somewhere?
You should really look into the Try/Catch construct for error handling; what you’re doing is nonstandard and a bit harder to follow. But you’re always going to be outputting an object with a full set...
View ArticleReply To: Blank entry in hash table or somewhere?
Some of the Win32 exception messages have newlines before the text, for some reason. If you just call Trim() on the Exception.Message property, it’ll strip those out. As Don mentioned, using...
View ArticleReply To: Blank entry in hash table or somewhere?
Thanks Don for your help. I originally tried to use a Try/Catch, but it seems rather difficult when I would have to do a nested Try/Catch. One for Test-Connection and another for the (3)...
View ArticleReply To: Blank entry in hash table or somewhere?
Thanks Dave – I’ll give it a shot! -Ken
View ArticleReply To: Blank entry in hash table or somewhere?
That was it! Thank you Don & Dave. I have been struggling with this for a few hours and getting frustrated. I also learned how to better use Try/Catch. -Ken
View ArticleReply To: Blank entry in hash table or somewhere?
BTW, you don’t need a Try/Catch for Test-Connection. If a ping fails, it won’t error when you’re using -Quiet, it’ll just return $False. You use Try/Catch when you’re expecting an error.
View ArticleReply To: Blank entry in hash table or somewhere?
If you want to try catch over multiple commands, try this. We’re using the Invoke character to run a number of commands through a single try/catch block because frankly we can’t be bothered to type...
View ArticleReply To: Posh Function – Schedule it as a Task?
For stuff like that I just dot source my script. If it’s not a real module and I just need it to stay resident in memory. a single dot followed by a space followed by a dot backslash and the file...
View ArticleReply To: Querying Inner Text with Multiple Attributes
OK – I have one more problem, then I am done with this script. Consider the following XML BLock: <TAX> <AMOUNT qualifier=”TAX” type=”T”> <VALUE>10</VALUE>...
View ArticleReply To: Querying Inner Text with Multiple Attributes
The actual XML block should be : <TAX> <AMOUNT qualifier=”TAX” type=”T”> <VALUE>10</VALUE> <NUMOFDEC>2</NUMOFDEC> <SIGN>+</SIGN> <CURRENCY />...
View ArticleReply To: Querying Inner Text with Multiple Attributes
Anytime you use Select-XML, it returns an object of type Microsoft.PowerShell.Commands.SelectXmlInfo. To get to the actual returned value, you’d need to look at the Node property of the SelectXmlInfo...
View Articleroaming profile permissions
Last year I started a new job at a company that was overwhelmed with IT and not enough staff to handle it for several years. I have slowly been able to assist in getting everyone up to speed and many...
View ArticleReply To: roaming profile permissions
hi, In the good old days, we used a resourcekit tool called subinacl.exe. That might be the a solution, unless you want to embark on a P/Invoke snippet in powershell. See this thread from the...
View ArticleReply To: roaming profile permissions
Yeah, unfortunately PowerShell remains sucky for file permissions. Set-Acl works, but basically gets down to .NET Framework programming. And no, you can’t use wildcards ;). But you could certainly...
View ArticleReply To: Web shop check with powershell
Yeah, how you do this depends a LOT on how the website physically works. For example, if it’s built entirely around post-backs (each click submits a request to the server), that’s not impossible to...
View ArticleConvertTo-HTML cmdlet
hi everyone, get-process | Select-Object name,Description,VM | ConvertTo-Html|Format-Table name,description,@{n='VM(MB)';e={$PSItem.VM / 1MB -as [int]};formatstring='f2'; align='right'} | Out-File...
View ArticleReply To: ConvertTo-HTML cmdlet
The output of Format-* cmdlets cannot be consumed by anything but Out-File, Out-String, Out-Printer, and Out-Host. This is a common mistake, as described in “The Big Book of PowerShell Gotchas”...
View ArticleIssue with Regestry with SEP Ver 12
$ServerList = Get-Content “H:\My Documents\My Powershell\serverlist.txt” $c=Get-Credential foreach ($computer in $ServerList) { write-host `n if (Test-Connection -ComputerName $computer -Quiet) {...
View ArticleReply To: Issue with Regestry with SEP Ver 12
If its working on SEP 11 and not SEP 12 I’d start thinking that something in SEP has changed. Try RDPing onto a SEP 12 machine and check that the registry keys you are using are correct. Test remoting...
View Article