$a = $a.Replace("Scriptign", "Scripting")
Lots of stringy stuff in a great technet article
3/19/2011
Powershell: Strings
text search and replace in a string is so easy:
Hash of Arrays
Advanced data structures are sometimes so complicated that I have no use for them. However I have found that a hash of arrays is very useful. Gathering data into the structure and retrieving it is elegant and saves a lot of strange contortions using variables just for looping and incrementing an index/etc. (For example, for each mailbox in a list write $alias[$mailbox]. Or just $alias['JimBob']...)
However, moving from Perl to Powershell I found myself having to re-learn how to make them work.
The following junk helped me to experimentally muddle through the process in PowerShell:
However, moving from Perl to Powershell I found myself having to re-learn how to make them work.
The following junk helped me to experimentally muddle through the process in PowerShell:
$List = 'User1','User2'
$MBX = 'Box1','Box2'
$MBX += 'Box2'
#$prm=@{$MBX=$List}
$prm=@{$MBX[1]='User1','User2'}
$prm.($MBX[1])+='User3'
$prm
write " "
$MBX = $MBX | Select -Unique
$MBX
TLS Testing
A while back I found myself needing to verify that my e-mail gateways support for TLS was still working after some system changes. Rather than having to find a live person to test with, a search turned up this testing site. It is very convenient and a cool way to test.
www.checktls.com
www.checktls.com
Interesting Article
I've had a lot of questions and speculation coming my way about hosted Exchange and "cloud" this and that.
(The Cloud reminds me of how nobody really knew what an extranet was back in the 90's but talked about it all the time...)
This is a very good article about pros and cons of hosted Exchange.
(The Cloud reminds me of how nobody really knew what an extranet was back in the 90's but talked about it all the time...)
This is a very good article about pros and cons of hosted Exchange.
1/28/2011
When does computer group change take effect?
As it turn out, if you never reboot the computer then it never will. That is uberLame.
This is a little tidbit that a TON of group policy documentation needs to spell out. Or at least link to a good document. If you filter machine policies by group membership then you really have to reboot all the time in order to make it work. That's fine for desktop computers, but it's not what we want for servers. There is a lot of wasted internet out there where various clueless people are trying to figure this out. Microsoft should just come out and say it and then link that document to every document they have about things that use group memberships.
Here is a not-so-elegant workaround.
This is a little tidbit that a TON of group policy documentation needs to spell out. Or at least link to a good document. If you filter machine policies by group membership then you really have to reboot all the time in order to make it work. That's fine for desktop computers, but it's not what we want for servers. There is a lot of wasted internet out there where various clueless people are trying to figure this out. Microsoft should just come out and say it and then link that document to every document they have about things that use group memberships.
Here is a not-so-elegant workaround.
1/24/2011
Powershell: WSUS
I suppose you might just say "DUH!" but I have to say again to myself if nobody else, PowerShell is very powerful and useful.
Here are some useful fragments I've got from a little tinkering with dates.
Again it's no surprise that TechNet was very useful. Especially this Powershell Tip about dates.
List the computers from WSUS and all info about them.
Here are some useful fragments I've got from a little tinkering with dates.
Again it's no surprise that TechNet was very useful. Especially this Powershell Tip about dates.
List the computers from WSUS and all info about them.
$WSUSserver="WSUS02"
$WSUSList="c:\export\WSUS\DATA\WSUSLIST.TXT"
New-Item $WSUSList -Type file -Force >$nul
#Get WSUS list
function Get-WSUSComputers()
{
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUSserver,$false)
$wsus.GetComputerTargets()
}
Get-WSUSComputers | Sort LastReportedStatusTime |`
Select * | `
Out-File -FilePath $WSUSList -Force
And, how about a list of machines for which last reported status was over a week ago.$WSUSserver="WSUS02"
$today = Get-Date
$today = $today.touniversaltime()
$datecheck = $today.adddays(-7)
$WSUSList="c:\audit\DATA\NOTREPORTING.TXT"
New-Item $WSUSList -Type file -Force >$nul
#Get WSUS list
function Get-WSUSComputers()
{
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUSserver,$false)
$wsus.GetComputerTargets()
}
Get-WSUSComputers | Sort LastReportedStatusTime |`
Select FullDomainName, LastReportedStatusTime | where {$_.LastReportedStatusTime -le $datecheck} | `
ft -auto | `
Out-File -FilePath $WSUSList -Force
Subscribe to:
Posts (Atom)