Windows

Windows: Unsolicited Remote Assistance

I knew that this existed, but didn’t need it until this past weekend.

One of my work environments has a need for remote connections for troubleshooting purposes, with the requirement of getting the approval of the remote user. They were given SMS 2003’s remote control capability, and then it was taken away.

So I did a Google search on ‘Scripted “Remote Assistance”‘ and found many results. I was thinking I could pass a computername or IP to a script, and then have it initiate Windows XP’s Remote Assistance.

Then I learned of “Unsolicited” Remote Assistance. Nice little thing that Microsoft added there.

If you Run (or use Internet Explorer) the following link, you will see the interface:
hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,
C=US/Remote%20Assistance/Escalation/unsolicited/unsolicitedrcui.htm

Your mileage may vary as to the exact look, depending on your Windows installation. Different vendors customize the Microsoft Help and Support Center, so your window may look a little different.

Simply enter a computer’s Name, FQDN, or IP, and Connect. Then pick the user you wish to help, and click Start Remote Assistance.

There are some GPO settings that I’ll add if you need to enable Remote Assistance on your desktops. Here’s a link to a little more information:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/
technologies/security/ws03mngd/20_s3rem.mspx

Enjoy.

Read more

Windows

AutoIT: Give users the ability to defrag without Admin access

I found a cool tool this weekend, called AutoIT V3.

You can find it here: http://www.autoitscript.com/autoit3/

I put together a script that will (running as the local admin) allow a user that has zero admin priviledges the ability to defrag their hard drive.

Here’s the script:
;**** AutoIT Script to allow users to defrag their hard drive ****
; Set the RunAs parameters to use local adminstrator account
RunAsSet(“Administrator”,@ComputerName, “PASSWORDHERE”)

; Run defrag as admin
RunWait(“mmc.exe dfrg.msc”,@SystemDir)

; Reset user’s permissions
RunAsSet()

;**** End of Script ****

Save this as defragit.au3, and then using the AutoIT scripting tools and compile the au3 you created.

You can download the script here.

And you can download AutoIT here.


If you want to add a cool Vista style .ico, look at Jrdn88’s gallery: http://jrdn88.deviantart.com/gallery/

Read more

VBS

VBS: NIC Show Icon/Power Mgt Script

Here’s script that I wrote (and probably borrowed some of it) to turn all nics’ icons on, and disable power management for them. It only looks at nics with IP enabled.
You can also download it here.
(Just make sure you rename it to nicmod.vbs, or something similar)

‘************************************************************************
‘* VBS Script to:
‘* Enable/Disable showing the icon in your system tray for connected NICs
‘* Enable/Disable Power Management for Connected NICs
‘*
‘* 8 MAY 06 – Jase McCarty
‘************************************************************************

‘Let’s setup our variables
Const HKLM = &H80000002 ‘HKEY_LOCAL_MACHINE info for registry writes
Dim objReg ‘Registry Object
Dim objWMIService ‘WMI Service Object
Dim arrayNetCards ‘Array of all connected NICs
Dim objNetCard ‘A specific NIC
Dim strNICguid ‘
Dim strShowNicKeyName ‘Key Specific to the Network Adapters in CurrentControlSet
Dim strShowNicKeyName001 ‘Key Specific to the Network Adapters in ControlSet001
Dim strPnPCapabilitesKeyName ‘Key Specific to the Network Adapters in CurrentControlSet
Dim strPnPCapabilitesKeyName001 ‘Key Specific to the Network Adapters in ControlSet001
Dim strComputer ‘Name of computer to modify

‘You will have to reboot the system for the settings to take effect, or you could put it in a group policy to automatically run when a system performs a shutdown.
strComputer = “.” ‘Period = local computer

strShowNicKeyName = “SYSTEMCurrentControlSetControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}”
strShowNicKeyName001 = “SYSTEMControlSet001ControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}”
strPnPCapabilitiesKeyName = “SYSTEMCurrentControlSetControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}”
strPnPCapabilitiesKeyName001 = “SYSTEMControlSet001ControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}”

ShowNicdwValue = 1
‘1 for ON, 0 for OFF

PnPdwValue = 56
’56 to disable “Allow the computer to turn off this device to save power.”

’48 to enable “Allow the computer to turn off this device to save power.”

’32 to enable “Allow the computer to turn off this device to save power.”
‘ and enable “Allow this device to bring the computer out of standby.”

‘288 to enable “Allow the computer to turn off this device to save power.”
‘ and enable “Allow this device to bring the computer out of standby.”
‘ and enable “Only allow management stations to bring the computer out of standby.”

On Error Resume Next
Set objReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & strComputer & “rootdefault:StdRegProv”)
Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)

‘Look for the NICs that have IP enabled
Set arrayNetCards = objWMIService.ExecQuery (“Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True”)

‘Make changes on the NICs that have IP enabled
For Each objNetCard in arrayNetCards

strNICguid = objNetCard.SettingID ‘Get the GUID of the NIC
strDeviceID = Mid(objNetCard.Caption,6,4) ‘Get the DeviceID of the NIC

‘Change the “Show icon in notification area when connected value”
objReg.SetDWORDValue HKLM, strShowNicKeyName & strNICguid & “Connection”, “ShowIcon”, ShowNicdwValue
objReg.SetDWORDValue HKLM, strShowNicKeyName001 & strNICguid & “Connection”, “ShowIcon”, ShowNicdwValue

‘Change the Power Management Values
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName & strDeviceID & “”,”PnPCapabilities”,PnPdwValue
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName001 & strDeviceID & “”,”PnPCapabilities”,PnPdwValue
Next

Set objReg = Nothing

Set objWMIService = Nothing
‘*** END OF SCRIPT ***

You could also modify this script to take a list of computers, and make the changes on all of them.

Enjoy.

Read more

VBS

VBS: Update Services Password on Local/Remote Box

This script, will allow you to update passwords for services that “Log on As” set to use a domain account.
You can download it here.
‘***********************************************************
‘Written by Jase McCarty
‘Date: 03/29/2006

‘UPD8SVCS.vbs

‘Description: Change the password on a local
‘or remote system for a Service that has
‘”Logon As” set for a Domain Account
‘Useful for Servers when a service account
‘has a password change
‘***********************************************************
Option Explicit
Dim shellobj,env
Dim strUserDomain,strUserName,strPassword,strComputer
Dim CSComputerName,CSAccount,CSPassword,objWMIService
Dim objService
‘Check to make sure that we receive enough arguements (2 or more)
If Wscript.Arguments.Count < 2 Then

Wscript.Echo “Usage: UPD8SVCS.vbs USERNAME PASSWORD COMPUTERNAME”
Wscript.Quit

Else

‘Create a Shell Object & be able to get environment variables
Set shellobj = CreateObject(“Wscript.Shell”)
Set env = shellobj.Environment(“process”)

‘Setup default domain for credentials
‘(could be modified to be an attribute)
strUserDomain = env(“USERDOMAIN”)
strUserName = Wscript.Arguments(0)
strPassword = Wscript.Arguments(1)

‘Check to make sure we have enough arguements (2 or more)
If Wscript.Arguments.Count > 2 Then
‘If we 3, then the Computername will be the 3rd arguement
strComputer = Wscript.Arguments(2)
Else
‘If we only receive the first 2, then the Computername
‘will be the local computer
strcomputer = env(“COMPUTERNAME”)
End If

‘Call the ChangeServices subroutine
Call ChangeServices(strComputer,strUserDomain & “” & strUserName,strPassword)

WScript.Quit

End If

‘The ChangeServices SubRoutine
‘This requires a computername, account,and password to be passed to it
Sub ChangeServices(CSComputerName,CSAccount,CSPassword)

‘Setup a WMIService object, and setup a query to put all services in an array
Set objWMIService = GetObject(“winmgmts:\” & CSComputerName & “rootcimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_Service”,,48)

‘Loop through the array
For Each objService in colItems

‘If the “Logon As” of the current service matches the user specified,
‘change the password to the one specified
If Lcase(objService.StartName) = LCase(CSAccount) Then
‘Make the credentials change
errReturn = objService.Change(,,,,,,CSAccount,CSPassword)

‘Write to the screen and the computer’s event log, the success or failure
If err.number <> 0 then
shellobj.LogEvent 1,”Failure Changing Username and Password for ” _
& objService.DisplayName & ” run by user ” & CSAccount & “.”
Wscript.Echo “Failure Changing Username and Password for ” _
& objService.DisplayName & ” run by user ” & CSAccount & “.”
Else
shellobj.LogEvent 0,”Successfully Changed Username and Password for ” _
& objService.DisplayName & ” run by user ” & CSAccount & “.”
Wscript.Echo “Successfully Changed Username and Password for ” _
& objService.DisplayName & ” run by user ” & CSAccount & “.”
End If

End If

Next


End Sub

Read more