One of our client asked us to build there machine with desktop
wallpaper and Local Admin Password Set according to the location of
there Offices :-
Say if the Location is Long Beach they will have there machine name as LBwin7 where the first two characters in the machine name represents the location.
The Deployment of the machines were done through SCCM 2007.
So,we created a vb script which does this for us...(change the things in red according to your environment)
Pre-requisite - You need to have 4 different wallpaper and a bat file which sets the wallpaper.
The wallpaper & the bat files need to be present on location which can be accessible through it's UNC path during deployment through SCCM.
dim objSMSEnv
dim wshShell
dim sUserName
dim cname
dim strnew
Set WSHShell = CreateObject("wscript.shell")
Set objNetwork = CreateObject("WScript.Network")
set objSMSEnv = CreateObject("Microsoft.SMS.TSEnvironment")
cname = objSMSEnv("_SMSTSMachineName")
intCharacters=2
strnew=Left(cname,intCharacters)
if strnew = "LB" then
WSHShell.Run("ServerName\FolderName\LB.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
elseif strnew = "OC" then
WSHShell.Run("ServerName\FolderName\OC.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
elseif strnew = "SB" then
WSHShell.Run("ServerName\FolderName\SB.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
else
WSHShell.Run("ServerName\FolderName\MC.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
end if
What this script does is,it changes the windows default wallpaper to the one according to the location.
Windows Default wallpaper is present in OSDrive\windows\web\wallpaper\windows\img0.jpg
It just replaces this wallpaper with the new one by executing the bat file.
bat file :-
LB.bat :-
TakeOwn.exe /F %SystemRoot%\Web\Wallpaper\Windows\img0.jpg
icacls %SystemRoot%\Web\Wallpaper\Windows\img0.jpg /reset
XCopy /Y \\ServerName\FolderName\LB.jpg %systemroot%\web\wallpaper\windows\img0.jpg
Similarly, we need to create 3 separate bat file for other location.
What this bat file does is,it thakes the ownership of OSDrive\windows\web\wallpaper\windows\img0.jpg file & then it replace the image with the new one.
Say if the Location is Long Beach they will have there machine name as LBwin7 where the first two characters in the machine name represents the location.
The Deployment of the machines were done through SCCM 2007.
So,we created a vb script which does this for us...(change the things in red according to your environment)
Pre-requisite - You need to have 4 different wallpaper and a bat file which sets the wallpaper.
The wallpaper & the bat files need to be present on location which can be accessible through it's UNC path during deployment through SCCM.
dim objSMSEnv
dim wshShell
dim sUserName
dim cname
dim strnew
Set WSHShell = CreateObject("wscript.shell")
Set objNetwork = CreateObject("WScript.Network")
set objSMSEnv = CreateObject("Microsoft.SMS.TSEnvironment")
cname = objSMSEnv("_SMSTSMachineName")
intCharacters=2
strnew=Left(cname,intCharacters)
if strnew = "LB" then
WSHShell.Run("ServerName\FolderName\LB.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
elseif strnew = "OC" then
WSHShell.Run("ServerName\FolderName\OC.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
elseif strnew = "SB" then
WSHShell.Run("ServerName\FolderName\SB.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
else
WSHShell.Run("ServerName\FolderName\MC.bat")
cname = "."
Set objUser = GetObject("WinNT://" & cname & "/Administrator,user")
objUser.SetPassword "YourPassword"
objUser.SetInfo
end if
What this script does is,it changes the windows default wallpaper to the one according to the location.
Windows Default wallpaper is present in OSDrive\windows\web\wallpaper\windows\img0.jpg
It just replaces this wallpaper with the new one by executing the bat file.
bat file :-
LB.bat :-
TakeOwn.exe /F %SystemRoot%\Web\Wallpaper\Windows\img0.jpg
icacls %SystemRoot%\Web\Wallpaper\Windows\img0.jpg /reset
XCopy /Y \\ServerName\FolderName\LB.jpg %systemroot%\web\wallpaper\windows\img0.jpg
Similarly, we need to create 3 separate bat file for other location.
What this bat file does is,it thakes the ownership of OSDrive\windows\web\wallpaper\windows\img0.jpg file & then it replace the image with the new one.
No comments:
Post a Comment