Arkiv

Snip-IT Pro

Jobber du med script, web, kode ,kommandoer etc så er dette programmet et must. Utrolig nyttig og greit hvis du skal lime komandolinjer inn i powershell etc. Sjøl så ligger alle mine «snippits» under min Dropbox slik eg har backup…

Wscript.Arguments

Dim args, arg1 Set args = WScript.Arguments If args.Count 1 Then Wscript.Quit arg1 = args.Item(0) Select Case UCase(arg1) Case «VALUE1» Case Else Wscript.Echo «Error parsing parameter (» & arg1 & «)» End Select

Class object

Class TestClass Private Sub Class_Initialize ‘ Setup Initialize event. MsgBox(«TestClass started») End Sub Private Sub Class_Terminate ‘ Setup Terminate event. MsgBox(«TestClass terminated») End Sub End Class Set X = New TestClass ‘ Create an instance of TestClass. Set X =…

AD SystemInfo

‘ AD SystemInfo Dim objSysInfo Set objSysInfo = CreateObject(«ADSystemInfo») Dim strUserLdapPath strUserLdapPath = objSysInfo.UserName Dim objUser Set objUser = GetObject(«LDAP://» & strUserLdapPath) objUser.GetInfo

Wscript.Shell Environment

‘ Wscript Shell Dim WshShell Set WshShell = WScript.CreateObject(«WScript.Shell») ‘ Wscript Shell Environment variables Dim objEnv Set objEnv = wshShell.Environment(«Volatile»)

SpecialFolders

‘ Wscript Shell Dim WshSpecialFolders Set WshSpecialFolders = WScript.CreateObject(«WScript.Shell») Wscript.Echo WshSpecialFolders.SpecialFolders(«AllUsersDesktop») Wscript.Echo WshSpecialFolders.SpecialFolders(«AllUsersStartMenu») Wscript.Echo WshSpecialFolders.SpecialFolders(«AllUsersPrograms») Wscript.Echo WshSpecialFolders.SpecialFolders(«AllUsersStartup») Wscript.Echo WshSpecialFolders.SpecialFolders(«Desktop») Wscript.Echo WshSpecialFolders.SpecialFolders(«Favorites») Wscript.Echo WshSpecialFolders.SpecialFolders(«Fonts») Wscript.Echo WshSpecialFolders.SpecialFolders(«MyDocuments») Wscript.Echo WshSpecialFolders.SpecialFolders(«NetHood») Wscript.Echo WshSpecialFolders.SpecialFolders(«PrintHood») Wscript.Echo WshSpecialFolders.SpecialFolders(«Programs») Wscript.Echo WshSpecialFolders.SpecialFolders(«Recent») Wscript.Echo WshSpecialFolders.SpecialFolders(«SendTo») Wscript.Echo WshSpecialFolders.SpecialFolders(«StartMenu») Wscript.Echo WshSpecialFolders.SpecialFolders(«Startup») Wscript.Echo…

AddPrinters.vbs

Dim objNetwork, strPrintServer1, strPrintserver2 Set objNetwork = WScript.CreateObject(«WScript.Network») strPrintServer1 = «\\nt-server-1\» strPrintServer2 = «\\thsrv06\» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «BrotherTavle» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «hpLJ5000» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «DSC224c» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «DSC224» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «R2032fax» objNetwork.AddWindowsPrinterConnection strPrintServer1 & «Ricoh2032» objNetwork.AddWindowsPrinterConnection strPrintServer1…

Change PrintServer2.vbs

‘ ‘ Replace printer queues from old server with queues on new server ‘ ‘ Created 20090313 by Inge Brattaas (inge@netpower.no) ‘ Option Explicit On Error Resume Next ‘ ::: Global variables ::: Dim PrintServerOld PrintServerOld = «\\nt-server-1\» Dim PrintServerNew…

ChangePrintServer.vbs

‘ Endre Printer kø thsrv06 – Windows logon script ‘ Author ktb@netpower.no ‘ Version 1 – April 22th 2010 ‘ ——————————————————‘ Option Explicit On Error Resume Next Dim objNetwork, strUNCPrinter strUNCPrinter = «\\thsrv06\FTP1_Ricoh_SH» Set objNetwork = CreateObject(«WScript.Network») ‘ Seksjon for…

sComputer = «.» Set oRegistry=GetObject(«winmgmts:\\» & sComputer & «\root\default:StdRegProv») sKeyPath = «Software\Microsoft\Office\11.0\Outlook\Setup» oRegistry.CreateKey HKEY_CURRENT_USER, sKeyPath sValue = «\\domain.no\PRF\Outlook2003.prf» sValueName = «ImportPRF» oRegistry.SetStringValue HKEY_CURRENT_USER, sKeyPath, sValueName, sValue

‘ Created 20080929 – Inge Brattaas (inge@Netpower.no) ‘Option Explicit ‘On Error Resume Next ‘ init Dim ShowErrors, QuoteChr ShowErrors = CBool(True) ‘ Show messages if errors occur? QuoteChr = Chr(34) Dim FileSysObj, WshShell, AdSysInfo, UserObj, sTHaddress, sTOaddress, sTOTaddress, sTVaddress, sTMNaddress,…

‘Option Explicit On Error Resume Next ‘ init Dim ShowErrors, QuoteChr ShowErrors = CBool(True) ‘ Show messages if errors occur? QuoteChr = Chr(34) Dim FileSysObj, WshShell, AdSysInfo, UserObj, sTHaddress, sTOaddress, sTOTaddress, sTVaddress, sTMNaddress, strUserName, strUserDomain, objGroupDict, objNetwork Set FileSysObj =…

Shortcut to desktop

On Error Resume Next Dim objNetwork, _ objShell, _ objFSO, _ objGroupDict, _ objUser, _ objGroup, _ strUsrName, _ strUserName, _ strUserDomain, _ strUserProfile Set objNetwork = WScript.CreateObject(«WScript.Network») Set objShell = WScript.CreateObject(«Wscript.shell») Set objFSO = CreateObject(«Scripting.FileSystemObject») strUserProfile = objShell.Environment(«PROCESS»)(«UserProfile») strUserName…

Grouplist.csv

Lonn,T:,\\server\lonn$ Huldt_Lillevik,P:,\\srv02\HuldtLillevik$ Data_Access,F:,\\server\data$ Projects_Group,S:,\\file01\Projects$ C352_2ETG,!!,\\server\C352_2ETG CM2320MFP,!!,\\server\CM2320MFP Bizhub_Lager,!!,\\server\Bizhub_Lager

VBS Logon with Grouplist.csv

‘—————————————————- ‘Remove all Network printers but not local printers Set WshNetwork = WScript.CreateObject(«WScript.Network») Set Printers = WshNetwork.EnumPrinterConnections For i = 0 to Printers.Count – 1 Step 2 If Left(ucase(Printers.Item(i+1)),2) = «\\» Then ‘WScript.Echo Printers.Item(i+1) ‘WSHNetwork.RemovePrinterConnection Printers.Item(i+1) End IF Next On…

ChangeDriveLabels.vbs

mDrive = «f:\» Set oShell = CreateObject(«Shell.Application») oShell.NameSpace(mDrive).Self.Name = «Felles» mDrive = «k:\» Set oShell = CreateObject(«Shell.Application») oShell.NameSpace(mDrive).Self.Name = «Administrasjon» mDrive = «t:\» Set oShell = CreateObject(«Shell.Application») oShell.NameSpace(mDrive).Self.Name = «Trafikk» mDrive = «r:\» Set oShell = CreateObject(«Shell.Application») oShell.NameSpace(mDrive).Self.Name = «Verksted»…

DecToBin

‘ Example ‘ Wscript.Echo DecToBin(27) Function DecToBin(ByVal d) If Not IsNumeric(d) Then Exit Function Dim st st = «» Do While d > 0 If d Mod 2 > 0 Then st = «1» & st Else st = «0»…

ConvertFileSize

Function ConvertFileSize(integerSize) If integerSize >= 1000000000 Then ConvertFileSize = round(integerSize / 1000000000, 2) ConvertFileSize = ConvertFileSize & » GB» ElseIf ((1000000000 > integerSize) And (integerSize >= 1000000)) Then ConvertFileSize = round(integerSize / 1000000, 2) ConvertFileSize = ConvertFileSize & » MB»…

Function GetAllTwoLetterCombinations() Dim charArr, charArr2, strOut charArr = Array(«a»,»b»,»c»,»d»,»e»,»f»,»g»,»h»,»i»,»j»,»k»,»l»,»m»,»n»,»o»,»p»,»q»,»r»,»s»,»t»,»u»,»v»,»w»,»x»,»y»,»z») charArr2 = Array(«a»,»b»,»c»,»d»,»e»,»f»,»g»,»h»,»i»,»j»,»k»,»l»,»m»,»n»,»o»,»p»,»q»,»r»,»s»,»t»,»u»,»v»,»w»,»x»,»y»,»z») Dim i, j For Each i In charArr For Each j in charArr2 strOut = strOut & i & j & vbCrLf Next Next GetAllTwoLetterCombinations = strOut End…

Copy to Delete From.vbs

Dim objFSO Dim objShell Dim strUserProfile Set objFSO = CreateObject(«Scripting.FileSystemObject») Set objShell = WScript.CreateObject(«Wscript.shell») strUserProfile = objShell.Environment(«PROCESS»)(«UserProfile») ‘Copy to and delete from DESKTOP CopyToDesktop(«\\thsrv06\economyterminalserver$\Shortcuts\Desktop\BankX.lnk») MsgBox(«Fil er kopiert til skrivebord, trykk OK for å slette filen») DeleteFromDesktop(«BankX.lnk») ‘Copy to and delete…

RegWrite

Dim WshShell Set WshShell = WScript.CreateObject(«WScript.Shell») ‘ http://msdn.microsoft.com/en-us/library/yfdfhz1b%28VS.85%29.aspx ‘ example: WshShell.RegWrite «HKCU\Software\ACME\FortuneTeller\MindReader», «Goocher!», «REG_SZ» WshShell.RegWrite

Const ForReading = 1 Dim objFSO Set objFSO = CreateObject(«Scripting.FileSystemObject») Set objTextFile = objFSO.OpenTextFile _ («d:\My Dropbox\Archive\Netpower\Certificates\temp.txt», ForReading) Do Until objTextFile.AtEndOfStream strNextLine = objTextFile.Readline arrLine = Split(strNextLine , «;») Wscript.Echo « » & vbCrLf & vbTab & « » &…

DeleteSelf

‘ Example ‘ MsgBox «Before the self delete», vbInformation, «Self Deleting Script» ‘ Call DeleteSelf() ‘ MsgBox «After the self delete», vbInformation, «Self Deleting Script» Sub DeleteSelf() Dim objFSO Set objFSO = CreateObject(«Scripting.FileSystemObject») objFSO.DeleteFile WScript.ScriptFullName Set objFSO = Nothing End…

Create Shortcut

Dim WshShell, strDesktop, oShellLink Set WshShell = WScript.CreateObject(«WScript.Shell») strDesktop = WshShell.SpecialFolders(«Desktop») set oShellLink = WshShell.CreateShortcut(strDesktop & «\Shortcut To Notepad.lnk») oShellLink.TargetPath = «Notepad.exe» oShellLink.WindowStyle = 1 oShellLink.Hotkey = «CTRL+SHIFT+N» oShellLink.IconLocation = «notepad.exe, 0» oShellLink.Description = «Shortcut To Notepad.» oShellLink.WorkingDirectory = strDesktop…

This site is protected by WP-CopyRightPro