Scripting 101 for Network Administrators Jim Kent, Network Administrator Ave Maria Law School.

Slides:



Advertisements
Similar presentations
Auditing Microsoft Active Directory
Advertisements

AD User Import From SIMS.NET
Technology ICT Virtual PC. Network Resources Microsoft Virtual PC Allows multiple Guest Operating Systems (Virtual Machines) run using the resources of.
CREATING USER ACCOUNTS Group accounts simplify administration by organizing user accounts into a single administrative unit. They provide a convenient.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 9: Implementing and Using Group Policy.
VBScript Tim Sirgo
11 SUPPORTING LOCAL USERS AND GROUPS Chapter 3. Chapter 3: Supporting Local Users and Groups2 SUPPORTING LOCAL USERS AND GROUPS  Explain the difference.
MCT260-Operating Systems I Operating Systems I Networking.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 9: Implementing and Using Group Policy.
Network Shares and Accounts Sharing Printers, Drives, Folders – Setup Windows 95/98 Windows NT (2000, XP) Linux – Users – Groups.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 8: Implementing and Managing Printers.
Chapter 5: Configuring Users and Groups. Windows Vista User Accounts User accounts are the primary means of authentication Built-in Accounts –Administrator:
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 8: Implementing and Managing Printers.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 8: Implementing and Managing Printers.
Operating System & Application Files BACS 371 Computer Forensics.
OS and Application Files BACS 371 Computer Forensics.
© 2005 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Advanced Samba Administration Part.
Multi-Functional Printer Scan-to-PC (SMB) Office of the Chief Information Officer (OCIO) The Hong Kong Institute of Education Last Update: 06 Dec 2013.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
Chapter-4 Windows 2000 Professional Win2K Professional provides a very usable interface and was designed for use in the desktop PC. Microsoft server system.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 9: Implementing and Using Group Policy.
WMI Scripting. What Is WMI? WMI is the core management-enabling technology built into Windows 2000, Windows XP, and the Windows Server 2003 family of.
MCTS Guide to Microsoft Windows Server 2008 Applications Infrastructure Configuration (Exam # ) Chapter Two Deploying Windows Servers.
CN1276 Server (V3) Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Insert Instructors name Here. The evolution of the logon script In the past, we mapped everyone manually Used a simple how to pamphlet so the user could.
8.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 8: Introducing Computer Accounts.
One-To-One Instruction How to install MS Exchange with a two user setup on Windows Server 2003.
CIS250 OPERATING SYSTEMS WIN2k Lab # 3 Creating User Accounts Defining User Profiles Creating Groups Setting System Policies.
User Manager for Domains.  Manages the user accounts in a domain  It is located in the PDC  While User Manager exists in each NT machine, but it is.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
70-294: MCSE Guide to Microsoft Windows Server 2003 Active Directory, Enhanced Chapter 10: Managing Users, Groups, Computers and Resources.
With Windows XP, you can share files and documents with other users on your computer and with other users on a network. There is a new user interface.
CIM6400 CTNW (04/05) 1 CIM6400 CTNW Lesson 6 – More on Windows 2000.
Copyright 2000 eMation SECURITY - Controlling Data Access with
ADM 331 Administrative Scripting for IIS 6.0 Using WMI Alexis Eller Program Manager Internet Information Services (IIS)
Troubleshooting Windows Vista Security Chapter 4.
IOS110 Introduction to Operating Systems using Windows Session 8 1.
Login/Logout Procedures. Login – Windows XP Greeted by Technology Usage Agreement 1. User name text box 2-digit grad. Yr. + first initial + last name.
1 Installation When this module is complete, you will be able to:  Set a static IP address for your laptop  Install the snom ONE software  Navigate.
PC Maintenance: Preparing for A+ Certification Chapter 23: Using a Windows Network.
DIT314 ~ Client Operating System & Administration CHAPTER 5 MANAGING USER ACCOUNTS AND GROUPS Prepared By : Suraya Alias.
1 Chapter Overview Configuring Account Policies Configuring User Rights Configuring Security Options Configuring Internet Options.
Active Directory Administration Lesson 5. Skills Matrix Technology SkillObjective DomainObjective # Creating Users, Computers, and Groups Automate creation.
Lesson 1-Logging On to the System. Overview Importance of UNIX/Linux. Logging on to the system.
Windows 2000 Server Active Directory Groups User Accounts Frank Schneemann.
Chapter 10: Rights, User, and Group Administration.
Page 1 User Accounts Lecture 3 Hassan Shuja 09/21/2004.
Advanced System Management. Presented by Andrew Kutz Principal l o s t c r e a t i o n s
Guide to MCSE , Enhanced1 Activity 1-1: Determining the Windows Server 2003 Edition Installed on a Server Objective is to determine the edition of.
Simplify IT Management with AD Scripting Chalermrath K. (MCSE: Security) Jirat B. (MCSE, RHCE) Technology Specialists Microsoft Thailand.
Fall 2011 Nassau Community College ITE153 – Operating Systems Session 21 Administering User Accounts and Groups 1.
Administering Group Policy Chapter Eleven. Exam Objectives in this Chapter  Plan a Group Policy strategy using Resultant Set of Policy Planning mode.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
POWERSHELL BASICS. BACKGROUND  Powershell is a task automation and scripting language based off the.NET framework  It provides the user full access.
1 Active Directory Administration Tasks And Tools Active Directory Administration Tasks Active Directory Administrative Tools Using Microsoft Management.
 It is Microsoft's new task-based command- line shell and scripting language designed especially for system administration.  It helps Information Technology.
CHAPTER 5 MANAGING USER ACCOUNTS & GROUPS. User Accounts Windows 95, 98 & Me do not need a user account like Windows XP Professional to access computer.
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Chapter 7 Server Management Policies –User accounts –Groups Rights and permissions Examples.
IOAP Setup and Maintenance of Assessment Laptop. Introduction In order to have smooth functioning of laptops during ion assessments, a few setup activities.
IOAP Setup and Maintenance of Assessment Laptop. Introduction In order to have smooth functioning of laptops during ion assessments, a few setup activities.
Windows XP Professional Not Finish Yet
Logging Into Windows XP for first time (labs only!)
ACTIVE DIRECTORY ADMINISTRATION
Common SQL Server Mistakes and How to Avoid Them
Active Directory Administration
Windows 94
Unit 6 NT1330 Client-Server Networking II Date: 7/19/2016
Windows Professional xp Microsoft® ® Copyright ©
Presentation transcript:

Scripting 101 for Network Administrators Jim Kent, Network Administrator Ave Maria Law School

What is scripting ? Autoexec.bat, batch file scripts. Network login scripts. A script is a set of commands aimed at automating a process. Scripts are usually setup to solve a problem.

How to turn off the computers in the lab at the end of the day? shutdown -s -m \\hflyb01 -t 05 -f shutdown -s -m \\805x20b -t 05 -f shutdown -s -m \\535x20b -t 05 -f shutdown -s -m \\705x20b -t 05 –f Shutdown.exe is an add on from the resource kit.

What are we going to cover: WSH (Windows Script Host) VBScript (Visual Basic Scripting) WMI (Windows Management Instrumentation) ADSI (Active Directory Service Interfaces)

Simple Script Set objWMIService = GetObject("winmgmts:") Set objLogicalDisk = objWMIService.Get ("Win32_LogicalDisk.DeviceID='c:'") Wscript.Echo objLogicalDisk.Freespace

Free space on the local C: drive

Display Memory Script strComputer = "." Set objSWBemServices = GetObject ("winmgmts:\\" & strComputer) Set colSWbemObjectSet = objSWbemServices. InstancesOf("Win32_LogicalMemoryConfiguration") For Each objSWBemObject in colSWbemObjectSet Wscript.Echo "Total Physical Memory (kb): " & objSWbemObject.TotalPhysicalMemory next

Output from Memory Script

Output window Set ie = WScript.CreateObject("InternetExplorer.Applicati on", "IE_") ie.Navigate "about:blank" ie.ToolBar = 0 ie.StatusBar = 0 ie.Width = 600 ie.Height = 500 ie.Left = 0 ie.top = 0 ie.Visible = 1

Empty IE Window

Display Services Use WMI to output all the services on the computer. Also show the status of each service.

Do While (ie.Busy) Loop Set objDoc = ie.Document objdoc.Open objdoc.Writeln " Service Status " objdoc.Writeln " " objdoc.Writeln “ Service " objdoc.Writeln " State "

strComputer = "." Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer& "\root\cimv2") Set colServices=objWMIService.ExecQuery ("Select * from Win32_Service") For Each objService in colServices objdoc.Writeln “ " & objService.DisplayName & " " objdoc.Writeln " " & objService.State & " " objdoc.Writeln " " Next objdoc.Writeln “ " objdoc.Write()objdoc.Close

Display Info from a computer Use WMI to display the following stats. Display Computer Name Display the total physical ram in computer Display the time zone.

strComputer = "." Set objWMIService= GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery ("Select * From Win32_ComputerSystem") For Each objComputer in colSettings objdoc.Writeln " Computger Name: " objdoc.Writeln " " & objComputer.Name & " " objdoc.Writeln " Total Memory: " objdoc.Writeln " " & int((objComputer.TotalPhysicalMemory)/ ) & " " Next Set colSettings = objWMIService.ExecQuery ("Select * From Win32_TimeZone") For Each objComputer in colSettings objdoc.Writeln " Timezone: " objdoc.Writeln " " & objComputer.DayLightName & " " Next

Display same info on multiple computers Add the ability to read a text file of computer names. Use IE window to output the data for each computer.

Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("c:\cpu.txt", ForReading) Do While objFile.AtEndOfStream = false strComputer = objFile.ReadLine LoopobjFile.Close

Local logged on user Use WMI to display the logged on user. Setup script to show the user on all lab computers. Use a text file list of computers to check.

Do While objFile.AtEndOfStream = false strComputer = objFile.ReadLine Set objWMIService= GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery ("Select * From Win32_ComputerSystem") For Each objComputer in colSettings objdoc.Writeln " " & strComputer & " " objdoc.Writeln " " & objComputer.username & " " Next

Users logged into lab computers

WMI WMI comes standard preloaded and setup on Windows 2000/XP computers. Make sure the WMI service is running. Key to WMI is finding the class you want to query. Must have admin rights on local PC or networked pc to get any info back.

Download Scriptomatic

ADSI Released in 1997 as a set of generic interfaces that access and manipulate different directory services. Admins and Developers can use ADSI to enumerate and managed resources in a directory service. Can Read, Modify, Create and Delete domain objects.

All Users Script Set Computer = GetObject("WinNT://avemaria") Computer.Filter = Array("User") For Each User in Computer objdoc.Writeln " " objdoc.Writeln " UserName: " objdoc.Writeln " " & User.Name & " " objdoc.Writeln " " Next

All Users

Display all Domain Groups Set Computer = GetObject("WinNT://avemaria") Computer.Filter = Array("Group") For Each Group in Computer objdoc.Writeln " GroupName: " objdoc.Writeln " " & Group.Name & " " objdoc.Writeln " " Next

Display members of Student Group Set Group = GetObject("WinNT://avemaria/students, group") For Each User in Group.Members objdoc.Writeln “ UserName: " objdoc.Writeln " " & User.Name & " " objdoc.Writeln " " count = count + 1 Next

Display all groups of each student Set Group = GetObject("WinNT://avemaria/students, group") For Each User in Group.Members objdoc.Writeln " " & User.FullName &" " objdoc.Writeln " " objdoc.Writeln " " & User.Name &" " objdoc.Writeln " " Set User = GetObject("WinNT://avemaria/" & User.Name & ",user") For Each Group in User.Group For Each Group in User.Group objdoc.Writeln " " objdoc.Writeln " " objdoc.Writeln " " & Group.Name & " “ objdoc.Writeln " " & Group.Name & " “ Next NextNext

User Properties

Password Never Expires Flag? Set Group = GetObject("WinNT://avemaria/students, group") For Each User in Group.Members objdoc.Writeln " " & User.Name & " " Set User = GetObject("WinNT://avemaria/" & User.Name & ",user") flags = User.Get("UserFlags") If (Flags And &H10000) = 0 then objdoc.Writeln " Password will expire " objdoc.Writeln " Password will expire "Else objdoc.Writeln " Password does not expire " objdoc.Writeln " Password does not expire " End If objdoc.Writeln " " Next

Force Password change flag Force user to change password on next logon flag

Set Group = GetObject("WinNT://avemaria/students, group") For Each User in Group.Members objdoc.Writeln " " & User.Name & " " Set User = GetObject("WinNT://avemaria/" & User.Name & ",user") if User.passwordexpired = 0 then if User.passwordexpired = 0 then objdoc.Writeln " Password safe " objdoc.Writeln " Password safe " else else objdoc.Writeln " Force change set " objdoc.Writeln " Force change set " End If End If objdoc.Writeln " " Next

Modify User Flags

Create User Accounts Use text file for data source. Source reads one line of text at a time. Use ~ character to separate fields Username~password~fullname~ Description~loginscript kent1~password1234~kent, test1~Test Account~ student.bat

Do While objFile.AtEndOfStream = false strdataline = objFile.ReadLine myuser = Split(strdataline,"~") Set Computer = GetObject("WinNT://avemaria") Set User = computer.create("User",myuser(0)) call User.SetPassword(myuser(1)) user.fullname = myuser(2) user.Description=myuser(3)user.loginscript=myuser(4)user.setinfo Wscript.echo "Created user: " & myuser(0) Loop

Resources Microsoft Scripting Guide Microsoft Scripting Guide Microsoft Scripting Guide

Resources scriptcenter/default.mspx scriptcenter/default.mspx