by TechiBee
on April 27, 2010
Do you want to know how many user accounts/objects you can create in active directory? Want to know how many members a group can have? Want to know maximum number of GPOs a domain can have?. Microsoft AD documentation team has setup a technet page about these details along with some more valuable information.
Link to document : http://technet.microsoft.com/en-us/library/active-directory-maximum-limits-scalability(WS.10).aspx
{ }
by TechiBee
on April 27, 2010
Windows needs to download and install a software driver from the \<servername> computer print to <printer-name>. Proceed only if you trust the \<servername> compuer and the network.
You might see above message with “UAC” prompt to install drivers while adding network printers from a windows 7 computer. This behavior is expected as normal users are not allowed to add network printers(drivers installation requires admin rights) in a Windows 7 environment.
To fix this, you need to enable below group policies with described settings.
Computer Configuration -> Administrative Templates -> Printers -> Point and Print Restrictions and it’s settings should look like below.
Before reaching this policy setting, I have gone through the options to allow device and class ID/GUIDs through GPOs(click here for details) but in vain as they are not fully developed for printers.
Happy learning..,
Sitaram Pamarthi
{ }
by TechiBee
on April 24, 2010
German AD team has announced a sweet online tool(http://gps.cloudapp.net/default.aspx) which helps windows administrators in easily locating their GPO settings. It’s pretty useful tool in case if you want to refer a setting, regkey, path, description of a particular GPO to a friend or forum member.
I like it for two major reasons…
1) The easy access of registry key name/path of a particular GPO setting
2) It’s online and accessable for everywhere.
But I have seen that copy option in this tool is not consistently working. I am thinking that it is problem my browser(tried with IE and FF). Let me know if you also see this issue.
Thanks,
Sitaram
{ }
by TechiBee
on April 22, 2010
Microsoft has released a quick reference guide for PowerShell. It is not a in depth guide but one can paste it their desk for easy writting of scripts/oneliners.
{ }
by TechiBee
on April 20, 2010
I went to my friend room last week to see cricket match. He got a new mobile phone and trying to copy all his favorite songs into it. After copying a few he realized that, file name that appearing his laptop and display name in phone are not same for songs he is copying. He disappointed and figureout that he has o change the title of each song by going to properties of each mp3 file. As I just sitting beside to him, he asked me if I can automate anything there to speed up the process. He has lot of MP3 files in such manner and thought of helping him with my favorite powershell scripting.
I authored a small script, which reads files of given extension type and changes the title of them to file name. So that music players shows the same name when playing…
$files = Get-ChildItem -Filter *.mp3 -Path c:MyMusic -Recurse
$wmp = New-Object -ComObject wmplayer.ocx
foreach ($file in $files) {
$filename = $file.FullName
$fileshortname = $file.Name.Split(".")[0]
$metadata = $wmp.newMedia($filename)
if ($metadata.name -ne $fileshortname) {
Write-Host "Setting metadata"
$metadata.name = $fileshortname
}
}
{ }
by TechiBee
on April 19, 2010
As subject says, MS has released a new FREE e-book on MS SQL 2008 R2 a few days back. You can grab a copy of it from MS Press Blog
{ }
by TechiBee
on April 15, 2010
Can’t we really see the text/password entered through -AsSecureString or with Get-Credential? What I have to do if I got a requirement to compare the passwords? The example scenario for me as a System administrator is, if I have a script which resets admin password acrosss a list of hosts, I will prefer the script to ask for the password two times in secure format and inturn my script should compare these two passwords and proceed only if the passwords entered at two attempts is matched.
In one of the powershell blog author talked about seeing the secure text in plain format. I used that and developed below script for comparing the passwords using powershell.
Write-Host "Hey..!! I am here to compare the password you are entering..."
$pwd1 = Read-Host "Passowrd" -AsSecureString
$pwd2 = Read-Host "Re-enter Passowrd" -AsSecureString
$pwd1_text = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pwd1))
$pwd2_text = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pwd2))
if ($pwd1_text -ceq $pwd2_text) {
Write-Host "Passwords matched"
} else {
Write-Host "Passwords differ"
}
Let me know if you have any comments/questions…
{ }
by TechiBee
on April 15, 2010
[PLEASE USE https://techibee.com/powershell/check-disk-space-of-remote-machine-using-powershell/430 to check free disk space of remote computer. I made it more advanced there.]
Earlier I have written a onliner to find out the disk space of remote machine. Few of my friends told me that it’s format is not good and can be improved. With the skills I have acquired these days in powershell, I made another attempt to re-write it, and this time it’s a function with some neat formatting.
Another improvement in this post is, here I am using SyntaxHighliter to give a nice view of my powershell code. Thanks to the author of this WP plug-in. This plug-in sucks. It is changing the format of my powershell code.
function Check-Diskspace {
param (
[parameter(Mandatory = $true)]
[string]$computer
)
$cred = Get-Credential
$DriveName1 = @{name=”DriveName”;Expression={$_.DeviceID+””}}
$TotalSpace = @{name=”Total Space”;expression = {($_.size/1GB).ToString(“0.00")+” GB"}}
$FreeSpace = @{name=”Free Space”;expression = {($_.FreeSpace/1GB).ToString(“0.00")+” GB”}}
gwmi -Class Win32_logicalDisk -filter “Drivetype=’3'” -computer $computer -credential $cred | Select $DriveName1, $TotalSpace, $FreeSpace | ft -auto
$cred = $null
}
{ }
by TechiBee
on April 8, 2010
If you are interested to know when your mailbox is created, try below PowerShell Oneliner…Basically what this does is, it uses Outlook application and fetches one of it’s schema property named PR_CREATION_TIME which contains the mailbox creation time.
(New-Object -ComObject Outlook.Application).Session.DefaultStore.GetRootFolder().PropertyAccessor.GetProperty(http://schemas.microsoft.com/mapi/proptag/0x0E580102)
[Source:Shavy Blog]
{ }
by TechiBee
on March 31, 2010
Installation of time windows will be saved in Win32_OperatingSystem WMI class. Alternatively it will be available in registry(HKLMSOFTWAREMICROSOFTWINDOWS NTCURRENTVERSIONINSTALLDATE). So, now you need to figure out your own way of querying values from either wmi or from registry. Being a fan of powershell, I want you to help with two line PS code to get the installation date/time.
$osinstalledtime = gwmi win32_operatingSystem
write-host $osinstalledtime.ConvertToDateTime($osinstalledtime.InstallDate)
That’s it. I will give you the details you need.
{ }