^Ii^
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 8/12/2010
-
Status: offline
|
VBS --> PowerShell ???
Monday, September 06, 2010 9:58 PM
( permalink)
don't work on win7 ' script write in computer description in AD name of logined user
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
k = 34
kk = Chr(k)
Set WshShell = WScript.CreateObject ("WScript.Shell")
IF WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion") > "5.1" Then
objDefaultUserName =WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser")
LenDUN = InStr(objDefaultUserName,"\")
objDefaultUserName = Right(objDefaultUserName,LenDUN)
Else
objDefaultUserName =WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName")
End If
Set net = WshShell.Exec ("net config server /srvcomment:" & kk & objDefaultUserName & " " & objComputer.location & kk)
objComputer.Description = WSHShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\srvcomment")
objComputer.SetInfo
|
|
|
|
ebgreen
-
Total Posts
:
8227
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:VBS --> PowerShell ???
Tuesday, September 07, 2010 2:03 AM
( permalink)
So do you want to convert it to powershell, or do you want to get the VBS to work in W7? VBScripts run just fine in W7.
|
|
|
|
^Ii^
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 8/12/2010
-
Status: offline
|
Re:VBS --> PowerShell ???
Tuesday, September 07, 2010 2:13 AM
( permalink)
i want all))) but primary convert
|
|
|
|
TomRiddle
-
Total Posts
:
620
- Scores: 12
-
Reward points
:
0
- Joined: 2/7/2008
- Location: Australia
-
Status: offline
|
Re:VBS --> PowerShell ???
Thursday, September 16, 2010 2:25 PM
( permalink)
-join([int[]][char[]]'Ut|jwXmjqq%Wzqjx'|%{[char]($_-5)})
|
|
|
|
^Ii^
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 8/12/2010
-
Status: offline
|
Re:VBS --> PowerShell ???
Wednesday, September 29, 2010 7:04 PM
( permalink)
$dom = 'LDAP://DC=***;DC=***'
$filter = "(SamAccountName=$env:computername$)"
$root = new-object directoryservices.directoryentry $dom
$searcher = new-object directoryservices.directorysearcher
$searcher.searchroot = $root
$searcher.filter = $filter
$searcher.searchScope = "subtree"
$searcher.propertiesToLoad.add("Location")
$comp = $searcher.findOne()
$compLoc = $comp.Properties.location
$pathComp = $comp.path
"'" + $pathComp + "'"
$Registry_Key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI"
[Microsoft.Win32.RegistryKey]$username = get-item $Registry_Key
foreach ($p in $username)
{
foreach ($key in $p.getvalueNames())
{
if ($key = "LastLoggedOnUser")
{
$keyname2 = $p.GetValue($key)
}
}
}
$keyname = $keyname2 -split "\\",2
$keyname = $keyname[1]
$comp = gwmi win32_operatingsystem
$comp.description = "$keyname $compLoc"
$comp.put()
$adAccount = [ADSI]$pathComp
Write-Host $adAccount.Get(“Description”)
$adAccount.Put(“Description”,"$keyName $compLoc")
$adAccount.SetInfo()
that's all))
|
|
|
|
anytua34i
-
Total Posts
:
9
- Scores: 0
-
Reward points
:
0
- Joined: 1/24/2011
-
Status: offline
|
Re:VBS --> PowerShell ???
Monday, January 24, 2011 7:04 PM
( permalink)
|
|
|
|