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

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 Article


Reply 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 Article


Reply 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 Article

Reply To: Blank entry in hash table or somewhere?

Thanks Dave – I’ll give it a shot! -Ken

View Article

Reply 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 Article


Reply 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 Article

Reply 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 Article

Reply 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 Article


Reply 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 Article


Reply 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 Article

Reply 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 Article

roaming 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 Article

Reply 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 Article


Reply 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 Article

Reply 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 Article


ConvertTo-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 Article

Reply 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 Article


Reply To: ConvertTo-HTML cmdlet

Thanks for the help and recommendation Have a nice day

View Article

Issue 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 Article

Reply 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
Browsing all 13067 articles
Browse latest View live