Options
What do you use for Windows scripting?
binarysoul
Member Posts: 993
in Off-Topic
I'm just wondering what do you guys use to write scripts in a Windows environment?
Also, what are the most common tasks that system admins accomplish through scripts?
I read about Powershell, which has been around since 2003.
Also, what are the most common tasks that system admins accomplish through scripts?
I read about Powershell, which has been around since 2003.
Comments
-
Optionstiersten Member Posts: 4,505Use PowerShell. Anything else won't be as integrated or good.
Adding/deleting users. Enumerating all computers in your domain etc... -
Optionsphoeneous Member Posts: 2,333 ■■■■■■■□□□Use PowerShell. Anything else won't be as integrated or good.
Adding/deleting users. Enumerating all computers in your domain etc...
Agreed.
I only use vbscript for the time being since thats all I know It gets alot done its just that Powershell can do whole lot more.
These are good video tutorials. -
OptionsMishra Member Posts: 2,468 ■■■■□□□□□□vbscript
And batch if I need something really quick and dirty. -
Optionscrrussell3 Member Posts: 561+1 for Powershell. I would also recommend downloading Powergui (PowerGUI.org - Free Windows Powershell Community) and the QAD Active Directory Powershell cmdlets.MCTS: Windows Vista, Configuration
MCTS: Windows WS08 Active Directory, Configuration -
Optionsastorrs Member Posts: 3,139 ■■■■■■□□□□These days for Windows scripting I use PowerShell, then PowerShell, after that I'll try it in PowerShell, next I'll take another swing at it in PowerShell, finally attempting it one more time in PowerShell, and if that doesn't work then KIXtart (nothing beats the simplicity of KIX for some tasks), and only if I absolutely have to VBscript.
-
OptionsHeroPsycho Inactive Imported Users Posts: 1,940binarysoul wrote: »I'm just wondering what do you guys use to write scripts in a Windows environment?
Also, what are the most common tasks that system admins accomplish through scripts?
I read about Powershell, which has been around since 2003.
PowerShell all the way. Things I've done with PowerShell?- Created reports from AD of all Domain Controllers, every computer without the latest service pack, all users who have expired password or haven't logged in over a certain threshold, all users who hadn't been migrated yet, etc...
- Dumped DHCP configuration of all DHCP servers in an AD forest, totaling about 50 servers
- Cleared DNS cache across 120 DNS servers
- Processed users to add/remove from groups corresponding with phases in a complex forest migration
- Check disk space on servers and NetApp volumes
- Properly deprovision user accounts according to legal compliance/company policy guidelines
- Change local admin passwords across hundreds of servers and desktops
- Change DNS conditional forwarding for certain domains across 120 DNS servers
- Change TCP/IP configurations for over 100 servers simultaneous
- Clear out unneeded snapshots on VI3/vSphere environments.
- Create vSwitches across multiple ESX servers simultaneously
Good luck to all! -
Optionssambuca69 Member Posts: 262binarysoul wrote: »I'm just wondering what do you guys use to write scripts in a Windows environment?
Also, what are the most common tasks that system admins accomplish through scripts?
I read about Powershell, which has been around since 2003.
I used PrimalScript as my IDE, but in the process of moving to PowerGUI Script Editor from Quest.
I write in VBscript/WMI and making the move over to Powershell.
Some tasks I do via scripts:
-getting local admins to machines
-pulling Win32 logs
-grabbing PC info
-installing/uninstalling software
-checking GPOs -
OptionsClaymoore Member Posts: 1,637Powershell has only been around since 2006, with Exchange 2007 being the first product that required it - even the GUI Management Console really runs PS cmdlets. With add-ons like the ADCmdlets from Quest and the new features in PS 2.0, it really is the best choice for windows scripting.
Prior to that there was VB Script, which I never bothered to learn. I have also used Wise or the SMS Installer to write compiled scripts, and before that I even used a little Kix scripting when a batch file wouldn't work. -
OptionsEverlife Member Posts: 253 ■■■□□□□□□□Powershell has only been around since 2006, with Exchange 2007 being the first product that required it - even the GUI Management Console really runs PS cmdlets. With add-ons like the ADCmdlets from Quest and the new features in PS 2.0, it really is the best choice for windows scripting.
Prior to that there was VB Script, which I never bothered to learn. I have also used Wise or the SMS Installer to write compiled scripts, and before that I even used a little Kix scripting when a batch file wouldn't work.
Does anyone have a good recommendation for a book on Powershell? -
Optionspennystrader Member Posts: 155There are good scripts that are batch, VBscript and powershell. Powershell would be good to learn but some of us are good at VB already and now trying to learn a new language. Either one can run WMI queries as it will get you back any information you need to know on any Windows machine. Powershell can do more functions with less code but VB still does a great job of gathering information. That being said I want to know both:)
Learning powershell myself by watching these videos and practicing.....
CBT Nuggets: On The Job Training Series: Windows PowerShell
The more knowledge one obtains the more there is too accumulate..... -
Optionscrrussell3 Member Posts: 561Haven't had a chance to read it yet, but here is a free powershell pdf book:
Master-PowerShell | With Dr. Tobias Weltner - PowerShell.comMCTS: Windows Vista, Configuration
MCTS: Windows WS08 Active Directory, Configuration -
Optionsbinarysoul Member Posts: 993Does anyone have a good recommendation for a book on Powershell?
My friend, you can try this published by Microsoft Press. Direct from horse's mouth
http://www.microsoft.com/learning/en/us/book.aspx?ID=9541&locale=en-us -
Optionsdynamik Banned Posts: 12,312 ■■■■■■■■■□binarysoul wrote: »My friend, you can try this published by Microsoft Press. Direct from horse's mouth
http://www.microsoft.com/learning/en/us/book.aspx?ID=9541&locale=en-us
Actually, that PoSh book got horrible reviews. Check out the Absolute Beginners book or other highly-reviewed books on Amazon. -
OptionsHeroPsycho Inactive Imported Users Posts: 1,940Does anyone have a good recommendation for a book on Powershell?
How about a free eBook?
Powershell TFM V1 eBook
http://www.primaltools.com/downloads/communitytools/
Best all around book IMO for learning PowerShell for admins. The Absolute Beginner one is arguably better for just learning how to script, but the book above is the best one for both the shell and scripting. Keep in mind the newer version of the book just released in eBook covers PoSh 2.0, but all the concepts of 1.0 pretty much carry over.Good luck to all! -
Optionsastorrs Member Posts: 3,139 ■■■■■■□□□□My vote for the 1st PoSh book everyone should pickup is Amazon.com: Windows Powershell in Action (9781932394900): Bruce G. Payette: Books
Read it cover to cover and practice as you go, it jumps around but if you follow it through you'll realize the things you were shown were at the right times. Jump around and you'll just get confused.
You can pickup what's new in 2.0 when you need to, after all you've got a lot to learn. -
Optionsphoeneous Member Posts: 2,333 ■■■■■■■□□□I've never used the netsh command. Put this together in just a few minutes.
@echo off netsh diag show computer netsh diag show ip netsh diag show dhcp netsh diag show dns netsh diag show gateway netsh diag show ieproxy netsh diag ping dhcp netsh diag ping dns netsh diag ping gateway netsh diag ping ieproxy netsh diag ping iphost 172.18.80.250 cmd /K
-
OptionsPash Member Posts: 1,600 ■■■■■□□□□□Powershell
Basic PC audit for a group of pc's
Search through a bunch of files on a select group of pc's for text patterns and make changes based on the results
VBScript
Interesting one in vbscript, had a FSA requirement come through to lock out PC's at a particular time in the evening (yeh financial traders do not like locking or turning off their pc's at all).
Basic stuff like enumerating AD user accounts to the domain with random generated passwords etc.
Batch
Using dnscmd tool to add multiple forwarders to the DNS servers as well as deleting a few.DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me. -
OptionsHeroPsycho Inactive Imported Users Posts: 1,940Don't forget you can use PowerShell in combination with batch and vbscript. For example, I added conditional forwarders to DNS servers using PowerShell to get all the DC's in the forest which were also all the DNS servers, then used a foreach-object loop to launch the dnscmd command string that added the conditional forwarding.Good luck to all!
-
OptionsPash Member Posts: 1,600 ■■■■■□□□□□HeroPsycho wrote: »Don't forget you can use PowerShell in combination with batch and vbscript. For example, I added conditional forwarders to DNS servers using PowerShell to get all the DC's in the forest which were also all the DNS servers, then used a foreach-object loop to launch the dnscmd command string that added the conditional forwarding.
That sounds more logical, just giving examples of scripting ive used based on skillset and when I did them kind of thing. They all have uses, I mean batch is still very usable for deployment server scripting (eg. Altiris).DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me.