line editing tricks and shortcuts for powershell -
I’ve been using PowerShell for a couple years now and I didn’t know hitting Esc cleared the current line…
export and import ou's and users from ad -
Perfect for setting up a lab.
install any version of vsphere client on win8
change win7 explorer default view to my computer -
This always bugged me but it’s taken me this long to actually google how to fix it…
change windows server edition with dism
spiceworks - free monitoring and alerting for windows and linux -
How am I just now discovering Spiceworks? This is amazing, can’t believe it’s free*.
*they do collect info/data but it’s supposedly anonymized
Here’s a little PowerShell script you can use to change the time zone for all computers in a certain OU.
Start-Transcript
Import-Module ActiveDirectory
$cred = Get-Credential
$arr = Get-ADComputer -SearchBase ‘OU=Servers,OU=example,dc=blah,dc=com’ -Filter ‘*’ | Select-Object -ExpandProperty Name
#for debugging - manually set the array for testing
#$arr = “server01”, “server02”
foreach ($a in $arr)
{
Write $a
Write “current time zone is”
invoke-command -cn $a -cred $cred {tzutil /g}
Write “———————”
Write “overwriting time zone”
invoke-command -cn $a -cred $cred {tzutil /s “Central Standard Time”}
Write “———————”
}
Stop-Transcript
vmware file level restores with netapp datastores -
Works great for Windows MBR disks, but not so much for GPT disks. Anyone have a solution for GPT disks?
Props to TechNet forums user philldogger for this one. If you want to build a group in AD based on the value of an attribute that the users will have (e.g. make a DFS group based on Department) you can do this:
Import-Module ActiveDirectory
Get-ADUser -filter{department -like “Accounting”} | %{Add-ADGroupMember dfs_dept_Accounting $_.SamAccountName}
In this example I am specifying the “department” AD attribute and looking for anyone who’s Department is set to “Accounting” and adding them to my AD group named “dfs_dept_Accounting”.
If you want to script it so the group membership is updated as new people join, add this line below the importing of the AD PowerShell module.
Get-ADGroupMember dfs_dept_Accounting | %{remove-adgroupmember dfs_dept_Accounting $_.SamAccountName -Confirm:$false}
This will wipe out the group and then re-add everyone. You can have one script per group you’d like to be updated, or combine multiple into one script. Fair warning though, if you have a good sized AD the script’s could take a long time to run and may hammer your DC’s so do due diligence.
wpkg - free software deployment and management for windows -
Haven’t tried it out yet but this looks really handy.