صفحه 4 از 7 اولیناولین 1 2 3 4 5 6 7 آخرینآخرین
نمایش نتایج: از شماره 46 تا 60 از مجموع 92

موضوع: بانک اسکریپت پرشین نـتـورک

  
  1. #46
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    List all groups in the domain and all members of the groups


    List all the domain groups and members of those groups into a tab seperated format text file. Result can be imported into excel. Also shows one of the few times you will need to set an object to nothing (remove those lines and you get bad results). Tested on a 2003 domain, unknown if it will work on a 2008 domain.
    VBScript
    کد:
    ' *****************************
    ' * List All Groups in the Domain and
    ' * List All Members of each Group
    ' * 
    ' * Output to a text file on the user's desktop in the format:
    ' * group name <tab> type <tab> member name <tab> type
    ' * Prompt for text file name.
    ' * Written by James Anderson, July 2009
    ' *****************************
    ' Variables
    Const MY_DOMAIN = "dc=fabricam,dc=com"
    ' *****************************
    ' Start Main
    On Error Resume Next
    Const ADS_SCOPE_SUBTREE = 2
    Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
    Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4
    Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8
    Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000
    Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
    Const MYPROMPT = "Enter the Output filename (i.e. Groups.txt) that will be saved on your desktop:"
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    ' Setup the output file
    If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
      WScript.StdOut.Write MYPROMPT & " "
      strMyFileName = WScript.StdIn.ReadLine
    Else
      strMyFileName = InputBox( MYPROMPT )
    End If
    if strMyFileName = "" then
      wscript.quit
    end if
    Set WshShell = CreateObject("WScript.Shell")
    Set WshSysEnv = WshShell.Environment("PROCESS")
    strMyFileName = WshSysEnv("USERPROFILE") & "\Desktop\" & strMyFileName
    Set WshSysEnv = nothing
    Set WshShell = nothing
    if objFSO.FileExists(strMyFileName) then
      'objFSO.DeleteFile(strMyFileName)
      wscript.echo "That filename already exists"
      wscript.quit
    end if
    
    ' Get a recordset of groups in AD
    Set objMyOutput = objFSO.OpenTextFile(strMyFileName, ForWriting, True)
    Set objConnection = CreateObject("ADODB.Connection")
    Set objCommand =   CreateObject("ADODB.Command")
    objConnection.Provider = "ADsDSOObject"
    objConnection.Open "Active Directory Provider"
    Set objCommand.ActiveConnection = objConnection
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    objCommand.CommandText = _
        "SELECT ADsPath, Name FROM 'LDAP://" & MY_DOMAIN & "' WHERE objectCategory='group'" 
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
    
    ' For each Group, Get group properties
    Do Until objRecordSet.EOF
      Set objGroup = GetObject(objRecordSet.Fields("ADsPath").Value)
      strGroupName = objRecordSet.Fields("Name").Value
      If objGroup.GroupType AND ADS_GROUP_TYPE_LOCAL_GROUP Then
        strGroupDesc = "Domain local "
      ElseIf objGroup.GroupType AND ADS_GROUP_TYPE_GLOBAL_GROUP Then
        strGroupDesc = "Global "
      ElseIf objGroup.GroupType AND ADS_GROUP_TYPE_UNIVERSAL_GROUP Then
        strGroupDesc = "Universal "
      Else
        strGroupDesc = "Unknown "
      End If
      If objGroup.GroupType AND ADS_GROUP_TYPE_SECURITY_ENABLED Then
        strGroupDesc = strGroupDesc & "Security group"
      Else
        strGroupDesc = strGroupDesc & "Distribution group"
      End If
    
      ' Check if there are members
      err.clear
      arrMemberOf = objGroup.GetEx("Member")
      If Err.Number = E_ADS_PROPERTY_NOT_FOUND then
        ' Write a line to the outputfile with group properties and no members
        objMyOutput.WriteLine(strGroupName & vbtab & strGroupDesc & vbtab & "<null>" & vbtab & "<null>")
      Else
        ' For each group member, get member properties
        For Each strMemberOf in arrMemberOf
          Set objMember = GetObject("LDAP://" & strMemberOf)
          strMemberName = right(objMember.Name,len(objMember.Name)-3)
          ' Write a line to the outputfile with group and member properties
          objMyOutput.WriteLine(strGroupName & vbtab & strGroupDesc & vbtab & strMemberName & vbtab & objMember.Class)
          set objMember = nothing
        Next
      End If
      objRecordSet.MoveNext
      Set objGroup = nothing
    Loop
    objMyOutput.close
    wscript.echo "Done!"



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  2. #47
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    List Installed Updates



    Submitted By: Wendell Averitt
    Returns a list of all the installed applications on the computer. The script runs through the list, removing any programs that do not have the letters KB in the application name, then saves the revised list to a text file
    VBScript
    کد:
    StrFile = "KB Report " & Replace(Date, "/", "_") & ".TXT"
    strComputer = "."
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(StrFile, 2, True)
    	 
    Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
    strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
        
    strKB = "KB"  
    
    	For Each subkey In arrSubKeys
    	strSubKeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall\" & subKey
    	strValueName = "DisplayName"
    	objReg.GetStringValue HKEY_LOCAL_MACHINE,strSubKeyPath,strValueName,strValue
    
    		If IsNull(strValue) Then
    			strName = subKey
    		Else
    			StrName = strValue
    		End If
    	
    		If InStr(strName,strKB) > 0 Then
    			strKBName = strKBName & strName & vbCrLf
    		End If
        
    	Next
    
    objFile.write strKBName
    
    Wscript.Echo "Scan Done"



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  3. #48
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    List Installed Service Packs and Hot Fixes


    Submitted By: Mohammed Athif Khaleel
    Lists installed Service Packs and hot fixes. Result are written to %temp%\UpdateList.txt and then displayed in Notepad
    VBScript
    کد:
    @echo off
    ::
    Echo This script will Query installed Service Packs and Hot fixes.
    REM Result will be written to %temp%\UpdateList.txt and then launched in Notepad.
    REM Disable Word Wrap and Save the batch file "UpdateList.cmd".
    Echo More information on http://msmvps.com/blogs/athif/archive/2005/11/20/76035.aspx
    REM Author:- Mohammed Athif Khaleel :- Date April 25, 2006
    Pause
    ::
    @echo on
    wmic /node:'sadaddr010' qfe GET description,FixComments,hotfixid,installedby,installedon,servicepackineffect > %temp%\UpdateList.txt
    notepad %temp%\UpdateList.txt



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  4. #49
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Map Network Drives and Log the Results


    Submitted By: J. Jason Bergh
    Maps drives and records the status to the Application event log. The script also determines the computer role and exits if the computer is a domain controller
    VBScript
    کد:
    ' Name		: Login.vbs
    ' Version	: 3.2, 04/15/2004
    ' Author	: J. Jason Bergh
    
    ' INITIALIZATION
    
    ' Declare Variables
    
    Option Explicit
    
    Dim objNetDrive		' Network Drive Object
    Dim objNetDriveEnum	' Network Drive Enumeration Object
    Dim objWMIService	' WMI Service Object
    Dim strComputer		' WMI Computer Namspace String
    Dim colItems		' WMI Item Collection (Win32_OperatingSystem)
    Dim colComputers	' WMI Computer Collection (Win32_ComputerSystem)
    Dim objItem		    ' WMI Item Object
    Dim objComputer		' WMI Computer Object
    Dim strError		' Event Log Error String
    Dim strSuccess		' Event Log Success String
    Dim strEventLog		' Event Log Report String
    Dim WshShl		    ' Windows Scripting Host Shell Object
    Dim WshNet		    ' Windows Scripting Host Network Object
    Dim i			    ' Counter
    
    ' Instantiate Variables
    Set objNetDrive = CreateObject("WScript.Network")
    Set WshShl = WScript.CreateObject("WScript.Shell") 
    Set WshNet = WScript.CreateObject("WScript.Network")
    
    ' Ignore Error Messages
    On Error Resume Next
    
    ' Instantiate Event Log Report
    strEventLog = "Login Script v.3.2 status as follows:"
    
    ' Determine OS Type and Role
    OSTypeAndRole()
    
    ' Enumerate Network Drives
    Set objNetDriveEnum = WshNet.EnumNetworkDrives
    
    ' Map Network Drives
    NetworkMapDrive "V:", "\\GODZILLA\DOWNLOADS"
    NetworkMapDrive "W:", "\\GODZILLA\DOCUMENTS"
    NetworkMapDrive "X:", "\\GODZILLA\PICTURES"
    NetworkMapDrive "Y:", "\\GODZILLA\MUSIC"
    
    ' Write Event To The Application Event Log
    EventLog()
    
    ' End Script
    
    ' FUNCTIONS
    
    Function OSTypeAndRole()
    
    	' Instantiate WMI
    	strComputer = "."
    	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    	Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
    
    	' Query Target OS Type
    	For Each objItem In colItems 
    		' Target is in the Windows NT family if OS Type 18
    		If objItem.OSType = 18 Then
    			' Query target and if the target's role is a Domain Controller (Primary, Backup) the Login script will exit.
    		
    			' Instantiate WMI
    			Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    			Set colComputers = objWMIService.ExecQuery ("Select DomainRole from Win32_ComputerSystem")	
    			' Query target role if target is in Windows NT family
    			For Each objComputer In colComputers
    				' Check target's role and terminate script if target is a Domain Controller (Domain Role > 3)
    				If objComputer.DomainRole > 3 Then
    					Wscript.Quit()
        				End If
    			Next
    		Else
    			' Operating System is not part of the Windows NT family, terminate the Login script
    			Wscript.Quit()
    		End If
    	Next
    
    	' Instantiate Error and Success string values
    	strError = "- Error determining operating system and role."
    	strSuccess = " - Windows NT family functioning as a member workstation / server."
    
    	' Check for errors
    	CheckError strError, strSuccess
    End Function
    
    Function NetworkMapDrive (Drive, Share)
    	' Enumerate and compare specified Drive Letter and UNC share point to mapped Drive Letters and UNC share points
    	For i = 0 to objNetDriveEnum.Count -1 Step 2
    		If LCase(Drive) = LCase(objNetDriveEnum.Item(i)) Then
    			If Not LCase(Share) = LCase(objNetDriveEnum.Item(i+1)) Then
    				' Remove Network Share Point
    				WshNet.RemoveNetworkDrive Drive, TRUE, TRUE
    			Else
    				' Drive mapped correctly, exit function
    				Exit Function
    			End If
    		End If
    	Next
    
    	' Map specified Drive Letter to specified UNC share point
    	WshNet.MapNetworkDrive Drive, Share, TRUE
    
    	' Instantiate Error and Success string values
    	strError = " - Error mapping drive " & Drive & " to " & Share & "."
    	strSuccess = " - Drive " & Drive & " mapped to " & Share & "."
    	
    	' Check for errors
    	CheckError strError, strSuccess
    End Function
    
    Function CheckError (EventError, EventSuccess)
    	' Function status reported to Application Event Log string
    	
    	' Check for errors
    	If Err > 0 Then
    		' Error occured, mark Event Log string accordingly
    		strEventLog = strEventLog & vbCR & EventError
    		Err.Clear
    	Else
    		' No errors, mark Event Log string complete for this function
    		strEventLog = strEventLog & vbCR & EventSuccess
    	End If
    End Function
    
    Function EventLog()
    	' Write Event to the Application Event Log
    	WshShl.LogEvent 0, strEventLog
    End Function



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  5. #50
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Map Printers and Drives Based on Computer OU


    Submitted By: Brad Pursell
    Maps printers according to the OU of the computer the user has logged on to. The script also logs the user name, computer name, IP address, logon time, and computer OU into an Access database
    VBScript
    کد:
    'This log on script will map printers according to the OU of the computer being logged into.
    'This was developed due to students moving from classroom to classroom needing different printers for each room
    'The script will also log username, computer name, IP address, logon time, and computer ou into an Access
    'database for tracking student access
    'written by Brad Pursell, pursellb@butlertech.org
    
    On Error Resume Next
    
    '=====VARIABLES=====
    
    Set objNetwork = WSCript.CreateObject("WScript.Network")
    strPooterName = objNetwork.ComputerName
    strUserName = objNetwork.UserName
    
    Set objWMIService = GetObject("winmgmts:\\" &  strPooterName & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    For Each objItem in colItems
        strIPAddress = Join(objItem.IPAddress)
    Next
    
    strTimeStamp = Now
    
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    
    '=====CONNECT TO AD=====
    
    Set objADConnection = CreateObject("ADODB.Connection")
    objADConnection.Open "Provider=ADsDSOObject;"
    
    Set objADCommand = CreateObject("ADODB.Command")
    objADCommand.ActiveConnection = objADConnection
    
    objADCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://dc=DOMAINNAMEHERE,dc=TLDOMAINHERE(E.G.,.ORG)' WHERE Name='" & strPooterName & "'"
    
    Set objADRecordSet = objADCommand.Execute
    
    '=====PARSE DN FOR OU=====
    
    Do While Not objADRecordSet.EOF
    	strDN = objADRecordSet.Fields("distinguishedName")
    	intCommaPosition=InStr(strDN, ",")
    	strOU = Mid(strDN, intCommaPosition + 1, Len(strDN) - intCommaPosition)
    	intCommaPosition = InStr(strOU, ",")
    	strOU = Mid(strOU, 1, intCommaPosition - 1)
    	intCommaPosition = InStr(strOU, "=")
    	strOU = Mid(strOU, intCommaPosition + 1, Len(strOU) - intCommaPosition)
    	objADRecordSet.MoveNext
    	'WScript.Echo strOU
    Loop
    
    objADConnection.Close
    
    '=====MAP DRIVES/PRINTERS BY OU=====
    
    Select Case strOU
    	Case "Technology Systems"
    		objNetwork.RemoveNetworkDrive "g:"
    		objNetwork.MapNetworkDrive "g:", "\\btfs1\fs5"
    		objNetwork.RemoveNetworkDrive "i:"
    		objNetwork.MapNetworkDrive "i:", "\\btfs1\fs1"
    		objNetwork.RemoveNetworkDrive "j:"
    		objNetwork.MapNetworkDrive "j:", "\\btfs1\fs2"
    		objNetwork.RemoveNetworkDrive "l:"
    		objNetwork.MapNetworkDrive "l:", "\\btfs1\paul1"
    		objNetwork.RemoveNetworkDrive "t:"
    		objNetwork.MapNetworkDrive "t:", "\\btfs1\vol1"
    		objNetwork.AddWindowsPrinterConnection "\\BTDC1\HPLJ4050_TechOffice"
    		objNetwork.AddWindowsPrinterConnection "\\BTDC1\HPLJ8100_TechRoom"
    		objNetwork.AddWindowsPrinterConnection "\\BTDC1\CanoniRC3200Color_LowerLevelERC"
    		objNetwork.AddWindowsPrinterConnection "\\BTDC1\CanoniR6000B&W_LowerLevelERC"
    		'objNetwork.SetDefaultPrinter "\\\"
    	Case "INSERT ANOTHER OU HERE"
    		'CREATE A SEPARATE CASE STATEMENT FOR EACH OU
    	case Else
    		'not found
    End Select
    
    '=====LOGGING=====
    
    Set objDBConnection = CreateObject("ADODB.Connection")
    Set objDBRecordSet = CreateObject("ADODB.Recordset")
    
    objDBConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source='\\***INSERT PATH TO ACCESS DB***\ACCESSDB.mdb'" 
    objDBRecordSet.Open "INSERT INTO Logons (Username, ComputerName, IPAddress, LogonTime, ComputerOU, ComputerDN) VALUES ('" & strUserName & "', '" & strPooterName & "', '" & strIPAddress & "', '" & strTimeStamp & "', '" & strOU & "', '" & strDN & "')", objDBConnection, adOpenStatic, adLockOptimistic
    
    objDBConnection.Close



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  6. #51
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Point Client Computers to a New Print Server


    Submitted By: Anonymous Submission
    Logon script that changes the printer connections on workstations
    VBScript

    کد:
    'This script works well in a login script. When ran from a workstation
    'it will loop thru all of the printers installed for the current logged on
    'user and if they are connected to the old server they will be removed
    'and then remaped to the new server. It will also attempt to descover
    'which printer is the default printer in order to reset this if it is one
    'of the printers that will be moved.
    '
    'Note: All of the printers must exist on the new server before this script
    ' should be run. If not then the printer will simply be removed from
    ' users profile and the script will not be able to reconnect them.
    ' "Print Migrator" is a utility that is part of the Windows 2000 and
    ' Windows 2003 resource kit. This will create all of the printers
    ' on the new server while maintaining all of their settings including
    ' print queue security. Keep in mind that for a time you will see
    ' duplicate printer if you do a search on printers, one advertisec
    ' from each server.
    '
    'We used this method to move just over 100 printers from one server to another
    'and then ran this script as a logon script in a group policy. We let it run for
    'a few days in order to allow for some users who don't logout every day have a
    'chance to run it. All of our users profiles were updated and they didn't even
    'know it was happening. We then deleted all of the printers from the old server.
    '
    'Note: The script does not run if you are Terminal serviced or SMS remote controling.
    
    
    Option Explicit
    Dim from_sv, to_sv, PrinterPath, PrinterName, DefaultPrinterName, DefaultPrinter
    Dim DefaultPrinterServer, SetDefault, key
    Dim spoint, Loop_Counter, scomma
    Dim WshNet, WshShell
    Dim WS_Printers
    DefaultPrinterName = ""
    spoint = 0
    scomma = 0
    SetDefault = 0
    set WshShell = CreateObject("WScript.shell")
    
    from_sv = "\\old" 'This should be the name of the old server.
    to_sv = "\\new" 'This should be the name of your new server.
    
    
    'Just incase their are no printers and therefor no defauld printer set
    ' this will prevent the script form erroring out.
    On Error Resume Next
    key = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
    DefaultPrinter = LCase(WshShell.RegRead (key))
    
    
    If Err.Number <> 0 Then
    	DefaultPrinterName = ""
    else
    'If the registry read was successful then parse out the printer name so we can 
    ' compare it with each printer later and reset the correct default printer
    ' if one of them matches this one read from the registry.
    spoint = instr(3,DefaultPrinter,"\")+1
    
     
    
    DefaultPrinterServer = left(DefaultPrinter,spoint-2)
    
    	if lcase(DefaultPrinterServer) = from_sv then
    		DefaultPrinterName = mid(DefaultPrinter,spoint,len(DefaultPrinter)-spoint+1)
    		scomma = instr(DefaultPrinterName,",")
    		DefaultPrinterName = left(DefaultPrinterName,scomma -1)
    	end if
    end if
    
    Set WshNet = CreateObject("WScript.Network")
    Set WS_Printers = WshNet.EnumPrinterConnections
    
    'You have to step by 2 because only the even numbers will be the print queue's
    ' server and share name. The odd numbers are the printer names.
    For Loop_Counter = 0 To WS_Printers.Count - 1 Step 2
    	'Remember the + 1 is to get the full path ie.. \\your_server\your_printer.
    	PrinterPath = lcase(WS_Printers(Loop_Counter + 1))
    
    	'We only want to work with the network printers that are mapped to the original
    	' server, so we check for "\\Your_server".
    	if lcase(LEFT(PrinterPath,len(from_sv))) = from_sv then
    		'Now we need to parse the PrinterPath to get rhe Printer Name.
    		spoint = instr(3,PrinterPath,"\")+1
    		PrinterName = mid(PrinterPath,spoint,len(PrinterPath)-spoint+1)
    		'Now remove the old printer connection.
    		WshNet.RemovePrinterConnection from_sv+"\"+PrinterName
    		'and then create the new connection.
    		'Do not create c6100
    		if lcase(PrinterName) <> "c6100" then
    			WshNet.AddWindowsPrinterConnection to_sv+"\"+PrinterName
    			'If this printer matches the default printer that we got from the registry then
    			' set it to be the default printer.
    			if DefaultPrinterName = PrinterName then
    				WshNet.SetDefaultPrinter to_sv+"\"+PrinterName
    			end if
    		end if
    	end if
    Next
    Set WS_Printers = Nothing
    Set WshNet = Nothing
    Set WshShell = Nothing
    
    ' wscript.echo "Printers Migrated"



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  7. #52
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Backup SharePoint Sites


    Enumerates and backs up SharePoint Sites to a specified backup directory
    VBScript
    کد:
    Option Explicit
    Const BU_FOLDER = "D:\WSS\Backup\"
    Const BU_SERVER = "http://sharepointserver.domain.com"
    Const STSADM_PATH = "C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm"
    Dim objFso
    dim objFolder
    dim objFiles
    dim objFile
    dim objShell
    dim objExec
    dim strResult
    dim objXml
    dim objSc
    dim objUrl
    dim strUrl
    dim strFileName
    dim strCmd
    Dim tstLog
    
    
    Set objFso = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFso.GetFolder(BU_FOLDER)
    Set objFiles = objFolder.Files
    
    Set tstLog = objFso.OpenTextFile(BU_FOLDER & "log.txt", 8, true)
    tstLog.WriteLine vbCrLf & Now() & " " &  "Backup will start..."
    
    
    Set objShell = CreateObject("WScript.Shell")
    Set objExec = objShell.Exec(STSADM_PATH & " -o enumsites -url " & BU_SERVER)
    strResult = objExec.StdOut.ReadAll
    tstLog.WriteLine String(50, "-")
    tstLog.WriteLine vbCrLf & Now() & " enumsites:" & strResult
    
    Set objXml = CreateObject("MSXML2.DOMDocument")
    objXml.LoadXML(strResult) 
    
    
    For Each objSc in objXml.DocumentElement.ChildNodes
        strUrl = objSc.Attributes.GetNamedItem("Url").Text
        strFileName = BU_FOLDER & _
          Replace(Replace(strUrl, "http://", ""), "/", "_") & "_" & Replace(Now(), ":", "") & ".spb"
          debug.writeline strFileName
        strCmd = STSADM_PATH & " -o backup -url """ + strUrl + """ -filename """ + strFileName + """"
        tstLog.WriteLine vbCrLf & Now() & " " & strCmd
        objShell.Exec(strCmd)
    Next
    tstLog.WriteLine vbCrLf & Now() & " " &  "Backup successfull!"
    tstLog.close



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  8. #53
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Toggle Internet Explorer Proxy Server Settings


    GUI utility for modifying Internet Explorer proxy server settings.

    VBScript


    کد:
    <html>
    <head>
    <title>Proxy Switcher</title>
    <hta:application 
       id="switchproxy"
       applicationName="Proxy Switcher"
       border="dialog"
       borderStyle="Complex"
       caption="yes"
       contextMenu="yes"
       icon=""
       innerBorder="yes"
       maximizeButton="no"
       minimizeButton="yes"
       navigable="yes"
       scroll="no"
       scrollFlat="no"
       selection="yes"
       showInTaskBar="yes"
       singleInstance="no"
       sysMenu="yes"
       version="1.0"
       windowState="normal"
     >
    
    </head>
     <script language="vbscript" >
        Sub curproxy
        Dim WshShell, bKey
        Set WshShell = CreateObject("WScript.Shell")
        regkey="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
    
        If WshShell.RegRead(regkey)=0 Then
            proxydisabled.checked=True
            proxyenabled.checked=False
            bthchangeproxy.Value="Enable Proxy"
            window.status="Your IE session is not configured to use a proxy server"
        Else
            proxydisabled.checked=False
            proxyenabled.checked=True
            bthchangeproxy.Value="Disable Proxy"
            window.status="Your IE session is configured to use a proxy server"
        End If  
        End Sub
        Sub chgproxy
        Dim WshShell, bKey
        Set WshShell = CreateObject("WScript.Shell")
        regkey="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
        If proxyenabled.checked=True Then
            WshShell.RegWrite regkey, 0, "REG_DWORD"
            proxydisabled.focus
            window.alert("IE will access the Internet directly.")
            curproxy()       
        Else
            WshShell.RegWrite regkey, 1, "REG_DWORD"
            proxyenabled.focus
            window.alert("IE will now use the defined Proxy server.")
            curproxy()       
        End If
        End Sub
     </script>
     <body STYLE="font:bold 22pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')" onload="curproxy()">
         Proxy Switcher<br />
         <br /><span style="font-size: 12pt; color: yellow; font-family: Tahoma">
         <input id="proxyenabled" name="proxyenabled" style="width: 22px" title="IE Currently using Proxy Server"
             type="radio" />IE is using Proxy Server<br />
         <input id="proxydisabled" name="proxydisabled" style="width: 22px" title="IE Currently using Proxy Server"
             type="radio" />IE is not using Proxy Server</span>&nbsp;<br />
         <input id="bthchangeproxy" name="bthchangeproxy" type="button" value="Change Proxy" onclick="chgproxy()" />
     
     </body>
    </html>



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  9. #54
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Delete Files 10 Days Old or Older


    VBScript

    کد:
    FilePath = "\\server\folder" 
    FileAge = 10
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(FilePath)
    Set colFile = objFolder.Files
    For Each objFile in colFile
    	FileCreated = objFile.DateCreated
    		If DateDiff("d", FileCreated, Now()) > FileAge Then 
     			objFile.Delete
    		Else
    		End If
    
    Next



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  10. #55
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    List FSMO Role Holders


    Uses a series of Dsquery commands to determine the FSMO role holders for a domain
    VBScript
    کد:
    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    
    strCmdRun = "cmd /c"
    strQuery = "dsquery server -hasfsmo "
    strQuerySchema = "schema"
    strQueryRID = "rid"
    strQueryName = "name"
    strQueryInfr = "infr"
    strQueryPDC = "PDC"
    
    Set objExec = objShell.Exec(strCmdRun & strQuery & strQuerySchema)
    strExecResultsSchema = LCase(objExec.StdOut.ReadAll)
    
    Set objExec = objShell.Exec(strCmdRun & strQuery & strQueryRID)
    strExecResultsRID = LCase(objExec.StdOut.ReadAll)
    
    Set objExec = objShell.Exec(strCmdRun & strQuery & strQueryName)
    strExecResultsName = LCase(objExec.StdOut.ReadAll)
    
    Set objExec = objShell.Exec(strCmdRun & strQuery & strQueryInfr)
    strExecResultsInfr = LCase(objExec.StdOut.ReadAll)
    
    Set objExec = objShell.Exec(strCmdRun & strQuery & strQueryPDC)
    strExecResultsInfr = LCase(objExec.StdOut.ReadAll)
    
    Wscript.Echo "FSMO Roles: "
    Wscript.Echo "-----------"
    Wscript.Echo "Schema Master: " & strExecResultsSchema
    Wscript.Echo " "
    Wscript.Echo "RID Master: " & strExecResultsRID
    Wscript.Echo " "
    Wscript.Echo "Domain Naming Master: " & strExecResultsName
    Wscript.Echo " "
    Wscript.Echo "Infrastructure Role: " & strExecResultsInfr
    Wscript.Echo " "
    Wscript.Echo "PDC Emulator: " & strExecResultsInfr



    ARM سپاسگزاری کرده است.

  11. #56
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Automate login to website


    This is a pretty neat (yet dirty) solution to a problem we were having. Our system kept losing a vital component, and the only way to restart this component was to log in to a webpage and click some checkboxes and manually restart the failed components.
    THis script automates Internet Explorer via the COM interface, which exposes the entire Document Object Model (DOM) to the awesomeness that is Powershell. You can do anything in POwershell that you can do in Internet Explorer, so you're limited by your own imagination (but Ajax can be tough).
    It also has an interesting function that will encrypt and decrypt a password from/to a file. This can only be decrypted by the user who encrypted the file (using Windows Auth) so if you're going to run this as a scheduled task, make sure that you create the password file while logged in as the user who the script will be executed as
    Windows PowerShell

    کد:
    ###################################################################
    # ScriptName: MonitorGridStatus
    # Author: Justin Yancey
    # Date: 20/01/2010
    # Description:
    #	This script will use the Internet Explorer COM object to log
    #	in to a web page for an automation tool we use. Unfortunately,
    #	the only way we can restart a failed "adapter" is to log in
    #	to this page and restart it manually. So, the script will 
    #	basically open IE, log in (using credentials stored in an
    #	encrypted file, decryptable only by the user who is executing
    #	the script), parse the HTML Document Object Model (DOM) and
    #	create custom objects representing the statuses of each 
    #	adapter. It will then check the status field of each object
    #	and, if it detects failure, will click buttons and tick checkboxes
    #	and send an email to the administrator to let them know something
    #	went wrong but it's been fixed now. 
    #
    #	I've included it in the "Using the Internet" category, as I use
    #	similar scripts for things like online banking (pays off a % of 
    #	my credit card every night), doing timesheets etc. This particular
    #	implementation could equally be classified as "Logs and Monitoring",
    #	but it's not a very good solution for this problem, i was just sick
    #	of getting calls from support in the middle of the night. 
    #
    ###################################################################
    
    # Define some variables that will change based on your configuration
    # I recommend storing these an XML file and reading them in at execution
    # time, but for the sake of this exercise i'm keeping it simple.
    
    $emailto = 'justin.yancey@somewhere.com'
    $emailfrom = 'justin.yancey@somewhere.com'
    $smtphost = 'mail.somewhere.com'
    $cdp = '10.0.0.01:9090'
    $username = $env:username
    $passwordfile = "C:\user\powershell\gridManagerLogin_$($env:username).txt"
    
    # Function to return a password from an encrypted file
    Function get-password([string]$credentialsfile) {
    	#Check to see if the file exists
    	if (-not (Test-Path $credentialsfile)){
    		#If not, then prompt user for the credential
    		$creds = Get-Credential
    		#Get the password part
    		$encpassword = $creds.password
    		# Convert it from secure string and save it to the specified file
    		$encpassword |ConvertFrom-SecureString |Set-Content $credentialsfile}
    	else {
    		#If the file exists, get the content and convert it back to secure string
    		$encpassword = get-content $credentialsfile | convertto-securestring
    	}
    	# Use the Marshal classes to create a pointer to the secure string in memory
    	$ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($encpassword)
    	# Change the value at the pointer back to unicode (i.e. plaintext)
    	$pass = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($ptr)
    	remove-variable encpassword,ptr
    	# Return the decrypted password
    	return $pass
    }
    
    # Create the IE com object
    $ie = new-object -com InternetExplorer.Application
    # Navigate to the login page
    $ie.navigate("http://$cdp/baocdp/gm/index.jsf")
    # Wait for the page to finish loading
    do {sleep 1} until (-not ($ie.Busy))
    #$ie.visible = $true #Uncomment this for debugging
    
    # Assign the DOM to the $doc variable
    $doc = $ie.document
    # Our login page remembers credentials for an hour even after
    # closing a browser, so we're going to enclose the login part
    # in a try-catch block, as these fields may not exist if we've already run this.
    try {
    	# Find the username field and set the value to that of our variable
    	$usernameField = $doc.getElementById('j_username')
    	$usernameField.value = $username
    	# Find the password field and set the value to that of the result
    	# of a call to the get-password function with the paramter defined at top
    	$passwordField = $doc.getElementById('j_password')
    	$passwordField.value = (get-password $passwordfile)
    	# Find and click the submit button
    	$submitButton = $doc.getElementById('submit-button')
    	$submitButton.click()
    	# Wait until login is complete
    	do {sleep 1} until (-not ($ie.Busy))
    } catch {$null}
    
    # Find the hyperlink we want to click by enumerating all <a href> tags matching on classname
    $link = $doc.getelementsbytagname('a') | where{$_.className -eq 'linkLarge linkLargeColor'}
    # Click the link
    $link.click()
    # WAit for page to finish loading
    do {sleep 1} until (-not ($ie.Busy))
    
    # Get the table containing our status messages and restart buttons
    $table = $doc.getelementbyid('stat-form:adp-st')
    
    # Split the table from a single string into an array of strings
    $html = $table.outerhtml.split("`n")
    
    # Loop through array, performing replacements of markup text to get rid of junk
    # This logic changes for every page you want to cleanse, so it will take a bit
    # of experimenting to get this working, but this is a good place to start.
    # For help with regexes, try The Regex Coach (free download)
    $html = $html |%{
    	$str = $_.replace('<TD class=gridStatusCell>','')
    	$str = $str.replace('<SPAN class=centralWorkItem>','')
    	$str = $str.replace('</SPAN></TD>','')
    	$str = $str.replace('</TD></TR>','')
    	$str = $str.replace('<IMG height=20 alt="','')
    	$str = $str.replace('</TBODY></TABLE>','')
    	$str = $str.replace('<INPUT.*?>','')
    	$str = [regex]::Replace($str,'" src.*?>','')
    	$str = [regex]::Replace($str,'<INPUT style.*?>','')
    	$str = [regex]::Replace($str,'<INPUT.*?=',',')
    	$str = $str.trim().trimend('>')
    	if ($str -notmatch '</*T' -and $str.length -gt 6){write-output $str}
    	}
    	
    # Sample from $html variable:
    # $html[0] = SQL Adapter
    # $html[1] = Running,stat-form:adapter1
    # $html[2] = File Adapter
    # $html[3] = Running,stat-form:adapter2
    	
    $i = 0; $ht = @{}; $oarray = @(); $o = $null;
    # Loop through the cleaned strings
    $html |%{
    	# If the value of $i (which is incrememted during each iteration) has no remainder
    	# after dividing by two, then the value in this string is the "Adapter name" (e.g. $html[0], $html[2])
    	if ([Math]::IEEERemainder($i,2) -eq 0){
    		# Add the previous object (if there was one) into the $oarray array
    		if ($o -ne $null) {$oarray += $o}
    		# Create a new object
    		$o = New-Object System.Object
    		# Add the "AdapterName" property
    		$o |Add-Member -MemberType NoteProperty -Name AdapterName -Value $_
    	} else {
    		# If there is a remainder, then the value in this string is the status, 
    		# as well as the name of the checkbox object that needs to be used later ($html[1],$html[3]).
    		# To restart an adapter, you have to select it (using this checkbox) and 
    		# click a stop button, check the box again and click a start button.
    		# Now, we split the string into the two variables
    		($adapterstatus,$checkboxname) = $_.split(',')
    		# Add the AdapterStatus member
    		$o |Add-Member -MemberType NoteProperty -Name AdapterStatus -Value $adapterstatus
    		# Add the name of the checkbox field to the Checkbox member
    		$o |Add-Member -MemberType NoteProperty -Name CheckBox -Value $checkboxname
    	}
    	$i++
    }
    
    $hasfailed = $false
    # Loop through all the adapter objects
    $oarray | foreach {
    	# If the status of the adapter is in "Fault" state
    	if($_.AdapterStatus -match 'Fault'){
    		# Find the checkbox field in the DOM
    		$chk = $doc.getElementByID($_.CheckBox)
    		# Check the checkbox
    		$chk.checked = $true
    		# Click the "Stop" button
    		$stopButton = $doc.getelementbyid('stat-form:stat-ctrl:stop-btn')
    		$stopButton.click()
    		# Wait a while
    		do {sleep 1} until (-not ($ie.Busy))
    		# Find the checkbox in the refreshed page
    		$chk = $doc.getElementByID($_.CheckBox)
    		# Check the checkbox
    		$chk.checked = $true
    		# Click the "Start" button
    		$startButton = $doc.getelementbyid('stat-form:stat-ctrl:start-btn')
    		$startButton.click()
    		# Wait until operation is complete
    		do {sleep 1} until (-not ($ie.Busy))
    		# Set the $hasfailed flag to be true
    		$hasfailed = $true
    	} elseif ($_.AdapterStatus -match 'Stop') {
    		# If the adapter is stopped, then...
    		# Find the checkbox field in the DOM
    		$chk = $doc.getElementByID($_.CheckBox)
    		# Check the checkbox
    		$chk.checked = $true
    		# Click the "Start" button
    		$startButton = $doc.getelementbyid('stat-form:stat-ctrl:start-btn')
    		$startButton.click()
    		# Wait until operation is complete
    		do {sleep 1} until (-not ($ie.Busy))
    	}
    }
    
    # If the script detected a failed adapter (not stopped, failed)
    if ($hasfailed) {
    	# Define the body text of the email contents
    	$bodytext = "An adapter has failed and has been restarted. Please log in to grid manager to confirm successful restart`n`n"
    	# Add the object outputs to the body so the recipient can see the adapter/s that failed
    	$bodytext += ($oarray |select AdapterName,AdapterStatus |out-string)
    	# Send the email using the variables defined at the top of the script
    	send-smtpmail -to $emailto -from $emailfrom -body $bodytext -Subject 'Adapter failure' -smtphost $smtphost
    }
    
    # Log out of the system
    $ie.navigate("http://$cdp/baocdp/j_spring_security_logout")
    # Wait until logout is complete
    do {sleep 1} until (-not ($ie.Busy))
    # Close IE
    $ie.quit()
    # Exit the script
    exit



    ARM سپاسگزاری کرده است.

  12. #57
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272

    Move Domain Users from Local Administrators Group to Local Power Users Group

    Submitted By: Alan Mosley
    Removes all domain users from the Local Administrators group on a computer, then adds those users to the Power Users group on that same machine
    VBScript
    کد:
    ' Removes domain users from local Administrators group and adds then to local Power Users Group
    ' from all computers in the active directory
    
    ' By Alan Mosley
    ' 21 August 2007
    
    'The statement 
    ' computer <> "DC1" AND computer <> "DC2" 
    'excludes computers DC1 and DC2 from being affected
    
    'The statement 
    ' wUser.Name <> "Administrator"
    'excludes the Domain Administrator from being removed
    
    'change netbios abd ldap domain strings 
    ' netbios = "fabrikam"
    ' ldapDomain = "LDAP://dc=fabrikam,dc=com"
    
    on error resume next
    Const ADS_SCOPE_SUBTREE = 2
    
    netbios = "fabrikam"
    ldapDomain = "LDAP://dc=fabrikam,dc=com"
    
    Set objConnection = CreateObject("ADODB.Connection")
    Set objCommand =   CreateObject("ADODB.Command")
    objConnection.Provider = "ADsDSOObject"
    objConnection.Open "Active Directory Provider"
    
    Set objCOmmand.ActiveConnection = objConnection
    objCommand.CommandText = _
        "Select Name, Location from '"& ldapDomain &"' " _
            & "Where objectClass='computer'"  
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
    
    dim computers()
    dim ub:ub = 0
    
    Do Until objRecordSet.EOF
        redim preserve computers(ub)
        computers(ub) = objRecordSet.Fields("Name").Value
        objRecordSet.MoveNext
        ub = UBound(computers)+1
    Loop
    
    for each computer in computers
        if computer <> "DC1" AND computer <> "DC2" then
            Set aGroup = GetObject("WinNT://" & computer & "/Administrators")
              On Error Resume Next
              For Each aMember In aGroup.Members
                    If aMember.Class = "User" Then
                    dim domainUser: domainUser = "WinNT://"& netbios &"/"& aMember.Name &",user"
                          Set wUser = GetObject( domainUser )
                          If Err.Number = 0 and wUser.Name <> "Administrator" Then
                            Wscript.echo wUser.Name
                            WScript.Echo wUser.ADsPath
                            Set puGroup = GetObject("WinNT://" & computer & "/Power Users")
                            puGroup.Add  (wUser.ADsPath)
                            aGroup.Remove wUser.ADsPath
                          else
                          err.Clear 
                          End If
                    end if
              next
        end if  
    next



    ARM، th95 و hosseini-n سپاسگزاری کرده‌اند.

  13. #58
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Assign the Default User Name Shown at the Logon Screen


    Changes the default user name shown on the Windows logon screen
    VBScript

    کد:
    Set wshShell = WScript.CreateObject("wscript.shell")
     Dim objShell
            Dim ssfWINDOWS
            Dim objFolder
            
            ssfWINDOWS = 36
            Set objShell = CreateObject("Shell.Application")
                Set objFolder = objShell.BrowseForFolder(0, "Select Profile for Current Logon name", 0, "C:\Documents and Settings")
                    If (Not objFolder Is Nothing) Then
                        wshshell.popup "The logon name you chose was " & objFolder,3, "Change Winlogon Name"
    						 Else WScript.Quit
                    End If
    '            Set objFolder = Nothing
    '        Set objShell = Nothing
    
    
    
    
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    
    Set Sh = CreateObject("WScript.Shell")
    'strUserName = InputBox ("Enter the UserName to be used as last User who Logged in.")
    strDomainName = InputBox ("Enter the DOMAIN to use with the UserName.", "Domain", "YOURDOMAIN NAME HERE") 
    
    key =  "HKEY_LOCAL_MACHINE\"
    Sh.RegWrite key & "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", ""&objFolder&"", "REG_SZ"
    Sh.RegWrite key & "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ALtDefaultUserName", ""&objFolder&"", "REG_SZ"
    Sh.RegWrite key & "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", ""&strDomainName&"", "REG_SZ"
    
    sh.popup "Done! Last UserName logged on Changed!",2,"Last User Logged in"



    ARM و hosseini-n سپاسگزاری کرده‌اند.

  14. #59
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Configure a Computer to Log On Automatically


    Configures a computer to automatically log on to the network each time it is turned on. Used in kiosk situations where a computer needs to be logged on to a specific account at all times
    VBScript

    کد:
    'Shortcut for connecting to the HKey_Local_Machine Registry Entry.
    const HKLM = &H80000002
    
    'This assigns the local computer name to the variable strComputer.
    strComputer = "."
    
    'creates a reference to the StdOut object in WSH.
    Set StdOut = WScript.StdOut
    
    'creates a a reference to the StdRegProv registry editing object.
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    strComputer & "\root\default:StdRegProv")
    
    'Assigns the path to the registry hive needed for this script.
    strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
    
    'All of the strValue and strValueName variables contain what is
    'actually written to the HKLM\Software\Microsoft\Windows NT _
    'CurrentVersion\Winlogon registry hive.
    
    'Default user name registry entry.
    strValueNameOne = "DefaultUserName"
    
    'Enter the User to be logged in here.
    strValueOne = "conference"
    
    'Registry entry for the Default Password.
    strValueNameTwo = "DefaultPassword"
    
    'Enter the password for the account above here.
    strValueTwo = "C0nference"
    
    'This tells the registry to login automatically
    strValueNameThree = "AutoAdminLogon"
    
    'set this to 0 turns off automatic login.
    strValueThree = "1"
    
    'Sets the registry entry for how many times this
    'account will automatically log in.
    strValueNameFour = "AutoLogonCount"
    
    'Change this value to set the number of Automatic Logins.
    '(4294967295 tells machine to always automatically login)
    strValueFour = "4294967295"
    
    'Registry entry to force login.
    strValueNameFive = "ForceAutoLogon"
    
    'Set this value to 0 will cancel forced login.
    strValueFive = "1"
    
    'This is the worker section of the script
    'It uses the reference oReg created earlier to actually write the
    'values to the registry. (Oreg.SetStringValue)
    oReg.SetStringValue HKLM,strKeyPath,strValueNameOne,strValueOne
    oReg.SetStringValue HKLM,strKeyPath,strValueNameTwo,strValueTwo
    oReg.SetStringValue HKLM,strKeyPath,strValueNameThree,strValueThree
    oReg.SetStringValue HKLM,strKeyPath,strValueNameFour,strValueFour
    oReg.SetStringValue HKLM,strKeyPath,strValueNameFive,strValueFive
    
    'The script finished message.
    Wscript.Echo "Script Done!"



    ARM سپاسگزاری کرده است.

  15. #60
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    Display Message at Startup


    Displays a .JPG file at startup. The actual file displayed in based on the screen resolution of the computer
    VBScript
    کد:
    on error resume next
    set destfile = nothing
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set destfile = fso.Getfile("C:\Custom\RISFinishCheck.txt")
    filesize = destfile.size
    if err.number <> 0 then
    	filesize = 1	
    end if
    if filesize = 290 then
    else
    strcomputer = "."
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoConfiguration",,48)
    For Each objItem in colItems
    	vertres = objItem.VerticalResolution
    Next
    LocalDC = WshShell.regread _
        ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\History\DCName")
    if vertres = "768" then
    	messagepath = localdc + "\netlogon\message\message.jpg"
    else 
    	messagepath = localdc + "\netlogon\message\message2.jpg"
    end if
    
    return = WshShell.Run ("iexplore -k " & messagepath,1,true)
    end if
    err.number = 0



    ARM و zoorba سپاسگزاری کرده‌اند.

صفحه 4 از 7 اولیناولین 1 2 3 4 5 6 7 آخرینآخرین

کلمات کلیدی در جستجوها:

پرشین نتورک

اسکریپت

نتورک ادمین

اسکریپت میکروتیک

اسکریپت ویندوز

http://forum.persiannetworks.com/f25/t31065.html

بانک اسکریپت

بانک

ادمین نتورک

اسکریپت در ویندوز

اسکریپت برای ویندوز

اسکریپت بانک

پرسین نتورکاضافه کردن پرینتر با اسکریپتconnection to dc scriptbatchفایلtelnet زدن در میکروتیکپ رسین نت ورکاسکریپت joinپرشن نتورکcloner.SendKeysبانك اسكريپاسكريپتterminalservicesprofilepath vbscriptبانک اسکرپیت

برچسب برای این موضوع

2003, 2008, 2008r2, 2911, 2960, 404, access, active, active directory, additional, admin, administrator, alias, application, archive, arp, backup, batch, bind, bios, bitlocker, browser, call, cdp, communication, computername, conference, configuration, control, crack, credentials, date, dcpromo, default gateway, delete, desktop, device, dhcp, disable, domain, domain controller, drive, email, enable, encrypt, error, failure, filter, finance, form, forum, gateway, google, gpo, group policy, gui, hardware, home page, host, html, http, img, install, ip address, ipconfig, ise, isolated, join, ldap, license, list, load, local, log off, log on to, login, loop, mac, map drive, memory, messaging, microsoft, microsoft office, monitoring, move, net stop, number, offline, page, password, personal, policy, pos, powershell, print server, problem, profile, queue, quota, ras, record, refresh, registerdns, remo, remote, remote desktop, replication, report, reset, resource kit, restart, restore, ris, role, route, run, s-1-5-21, sas, script, secure, send, serial, server, services, session, share, shared, sharepoint, shutdown, sms, smtp, smtp server, software, span, split, sql, start, startup, static, stop, support, switch, system center, target, telephone, telnet, test, ttl, update, user, username, فونت, فروش, لاگین, مایکروسافت, مدارک, نتورک, نصب شده, هستش, ویندوز, ویندوز 7, ورود, یوزر, کلاینتها, کمک, کانکشن, کار, کارها, کاربران, کردن, گوگل, گروپ پالیسی, پیشنهاد, پارتیشن, پرینتر, پرشین, پشتیبان گیری, vpn, wallpaper, wan, warning, web, web server, webpage, website, windows, windows server, windows server 2003, windows update, windows xp, word, wrt, wss, xml, آشنایی, اولین, اتوماتیک, اجرای, اسکریپت, اشتراک, اطلاعات, بک آپ, برنامه, تلنت, تنظیمات, تست, حداقل, حذف, خودکار, خودش, دومین, دانلود, درخواست, دستور, روی, روش, راهنمایی, رایگان, سوییچ, سیستم, سیستم سرور, سایت, شیر شده

نمایش برچسب ها

مجوز های ارسال و ویرایش

  • شما نمی توانید موضوع جدید ارسال کنید
  • شما نمی توانید به پست ها پاسخ دهید
  • شما نمی توانید فایل پیوست ضمیمه کنید
  • شما نمی توانید پست های خود را ویرایش کنید
  •