Script to map default printer based on user input
Hello everyone,
Complete scripting noob here but I managed to cludge together a vb script (from various sources) that will remove all current printers and then add printers based on group membership. It can also add a default printer and if they have a local printer
make that default. All that works just fine, my problem is that we have very large floors with many printer clusters. Group membership for printers is by floor and I do not have the option to further define this (Also GPO is not an option as getting
our network group to deploy anything takes years so we need to go this route).
What I would need is something graphical (like an HTA) that when run it prompts the user to input which floor they are on, then it asks them which of the print clusters (on the floor they specified) is closest to them. It would then install all the
printers on the floor and make the default printer one from the print cluster they indicated (unless they have a local printer). I hope this make sense.
I think I have most of the pieces laid out but I don't know how to get the user prompts/GUI and then perform the correct mappings. Thank you in advanced!
I agree with Bill. Using the correct method will be best. You network people will be more than happy to tell you what is set up and how to use it. You just need to ask your manager to get you in contact with them for a little parley.
If you are really insisting on a script then look in the repository. There are dozens of scripts that you can use and modify.
You should try to see this as a challenge to bring modern technology to your company. Approaching this kind of thing as a global IT challenge will usually get the attention of IT and they will usually take it seriously. You will likely learn
many things about the IT resources your company has.
¯\_(ツ)_/¯
I'm sorry if I wasn't clear but I'm not asking anyone to write the script for me, as I said I have most of the parts working. My issue is getting the user input and getting the script to take the action I need it to (I can map the printers based on
AD group membership I really just need to prompt the user to select which one they want as default). My thoughts were to wrap a GUI around it but it's not needed.
I agree that GPO is the way to go but in State Government it takes an act of Congress to get anything done in the mean time I'm trying to get things done with the means available to me.
Similar Messages
-
Set Default Printer based on user setting using Powershell script
Hi
I would like to create a script that runs on user log off and captures the default printer (set manually by the user) and then another script to reapply the settings (saved upon log off) when the user logs back in.
This is because local printers are set as default printer (PDF Creator Programs) when we all use Network Printers so this means a user has to set default printer to the network printer all the time.
I have found this script to start with:
$Printer = Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select name | out-file C:\temp\Printer.txt
But the out file looks like this:
name
\\PrinterserverName\Accounts01
Which I dont see how it can be used on another script plus there are spaces after\Account01
Any Ideas please?
M
MaelitoHi Maelito,
According to your description, you want to export the default printer name to text file, then read this printer name from text file and set the default printer via Powershell:
#save printer name to text file
Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select -ExpandProperty name | out-file C:\temp\Printer.txt
# read printer name from text file and set default printer
$name=get-content C:\temp\Printer.txt
(Get-WmiObject -Class Win32_Printer -Filter "Name='$name'").SetDefaultPrinter()
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Mapping default printer based on AD attribute
Hi all !
Sorry for my english, i'll try to be clear... :)
I need to run a VBscript on TSE 2008 R2 servers to set computer's
default printer (not user). For this, I need to use the ClientName var.
The default printer name is written in the computer's description attribute in Active Directory.
I'm a beginner in VBscripting. I have parts of scripts working, but not everything.
Here is my script (my comments are written with ''''''''''''''''''''''''''''''''''''''''''''):
'find clientname
strComputer = "."
Const ForAppending = 8
Set oNetwork = wscript.CreateObject("wscript.network") 'Create network object
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strUserName = oNetwork.userName
strComputerName = oNetwork.computerName
strClientName = objShell.ExpandEnvironmentStrings("%clientname%")
ExecuteSearch = SearchDistinguishedName(strClientName)
Public Function SearchDistinguishedName(ByVal vSAN)
Const ADS_SCOPE_SUBTREE = 2
Dim oRootDSE, oConnection, oCommand, oRecordSet
Set oRootDSE = GetObject("LDAP://rootDSE")
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = oConnection
ldstring = "'LDAP://" & oRootDSE.get("defaultNamingContext") & "'"
objCommand.CommandText = "Select Name, distinguishedName from "& ldstring & " where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If lcase(objRecordSet.Fields("Name").Value) = lcase(vSan) Then
Wscript.Echo "Client Name: " & objRecordSet.Fields("Name").Value & vbCrLf _
& "Location: " & objRecordSet.Fields("distinguishedName").Value
'Wscript.Quit
End If
objRecordSet.MoveNext
Loop
End Function
' find canonical name
On Error Resume Next
ADSRoot = "DC=domain,DC=fr"
Const ADS_SCOPE_SUBTREE = 2
Set objConnection2 = CreateObject("ADODB.Connection")
Set objCommand2 = CreateObject("ADODB.Command")
objConnection2.Provider = "ADsDSOObject"
objConnection2.Open "Active Directory Provider"
Set objCommand2.ActiveConnection = objConnection2
objCommand2.Properties("Page Size") = 1000
objCommand2.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand2.CommandText = _
"SELECT * FROM 'LDAP://" & ADSRoot & "' WHERE objectCategory='user' OR objectCategory='computer'"
''''''''''''''''''''''''''''''''''''Here, I use a input box to enter the clientname, cause I don't know how to re-use the clientname found in the lasts vars.
srchTrm = LCase(InputBox("Please enter your search term.", "Active Directory Search"))
WScript.Echo srchTrm
i = 0
If Len(srchTrm) < 4 or Instr(srchTrm, "=") Then
WScript.Echo "Please enter a search term in excess of 3 characters. Don't use ""="""
WScript.Quit
End If
Set objRecordSet2 = objCommand2.Execute
objRecordSet2.MoveFirst
Do Until objRecordSet2.EOF
strADPath = LCase(objRecordSet2.Fields("adsPath").Value)
If InStr(strADPath, srchTrm) Then
Set objUser = GetObject(objRecordSet2.Fields("adsPath").Value)
Select Case objUser.Class
Case "user"
strMsg = "Type: Person" & VbCrLf
strMsg = strMsg & "Name: " & objUser.DisplayName & VbCrLf
strMsg = strMsg & "Email: " & objUser.mail & VbCrLf
strMsg = strMsg & "Telephone: " & objUser.telephoneNumber & VbCrLf
strMsg = strMsg & "Department: " & objUser.department & VbCrLf
strMsg = strMsg & "Title: " & objUser.title & VbCrLf
Case "computer"
strMsg = "Type: Computer" & VbCrLf
strMsg = strMsg & "Name: " & objUser.Get("name") & VbCrLf
strMsg = strMsg & "OS: " & objUser.operatingSystem & VbCrLf
Case Else
strMsg = "Unidentified" & VbCrLf
End Select
'strMsg = strMsg & "LDAP: " & objUser.adsPath & VbCrLf
objUser.GetInfoEx Array("canonicalName"), 0
strMsg = strMsg & "AD Path: " & objUser.canonicalName & VbCrLf
objUser.GetInfoEx Array("description"), 0
strMsg = strMsg & "Imprimante: " & objUser.description
WScript.Echo strMsg & VbCrLf
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Here I want to use the "objuser.description" to set default printer
Dim WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.SetDefaultPrinter "\\SRV-PRINT.domain.fr\" & objUser.description
i = i + 1
End If
objRecordSet2.MoveNext
Loop
If Not i > 0 Then
WScript.Echo "No results found."
End If
I think there's a most simple way to do this, but for the moment, I Don't know how to do.
Any help would be grateful.Hello.
We need to do this because each computer in the office as a network printer (or nearly each computer). I can't do a Group Policy for each computer in my domain. We cannot work with users accounts, only computers .
My problem is that if the user1 is connected on Comp1, he must have the printer near computer 1 as default printer.
If user1 is connected on computer 2, at the other side of the office, he must have the printer near computer 2. So I cannot imagine a group policy to do this :).
We had the idea to use the descprition attribute in Active Directory to indicate the default printer to map.
We must now make a script to get clientname on the TSE session, look for the computer account in Active Directory, read its description's attibute and map the default printer.
For example, my computer is COMP01. I use a TSE environment on SRVTSE01.
The script need to determine which computer (COMP01) is connected to the SRVTSE01 server (clientname var), search Active Directory computer account of COMP01, read the account's description attribute (for example PRINT01) and set \\SRV-PRINT\PRINT01 as the
default printer on COMP01.
Hope it's better with this example... -
Open CC applications to default preferences with no user input
I am searching for a way to open CC applications to default preferences with no user input. I understand there is a key board short cut (command/option/shift on start) but I am hunting for a way to have the preferences always revert to default. In the past I have written a script to delete the preference files upon computer start up but once again, it needs to be rewritten. Is there a method that does not require KLUDGE?
Try:
*http://kb.mozillazine.org/Preferences_not_saved -
Drawing a line of asterisks based on user input - where do I start?
Greetings,
I'm trying to write an application that will ask the user for a number then the program will output that number in a line of asterisks based on user input - where do I start?
I really appreciate any informaiton.import javax.swing.*;
public class numbers {
public static void main ( String args[])
String strNumber;
int number = 0;
strNumber = "";
for (int num1 = 0; num1<=5; num1++)
strNumber = JOptionPane.showInputDialog ("How many Asterisks do you want printed?");
number = Integer.parseInt(strNumber);
for(int num=0; num<number; num++) System.out.print("*");
System.out.println("");
System.exit(0);
}This compiles fine, but it just keep rewriting the same thing... Any suggestions would be greatl appreciated. Also, how would I be able to confine the number entered to under 30?
THanks -
How to configure the schema name dynamically based on user input.
configure the schema name dynamically based on user input.
For ex:
We have two schemas:
Schema1 - base schema having 15 tables.
Schema2 - tables which is specific to modules. Having only 10 tables which is also available in Schema1
Login to application using Schema 1
Access a particlular module and select the country. Here country selection is identified.
Based on the country selection, we need to connect the schema respectively.
If the user selects France --> It should connect Schema1
If the user selects Germeny --> It should connect schema2.
Used: EclipselinkYou may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
You may also want to investigate EclipseLink multi-tenant support,
http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm
You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier. -
How to add column dynamically based on user input in oracle?
**how to add column dynamically based on user input in oracle?**
I am generating monthly report based on from_date to to_date below is my requirement sample table
EMPLOYEE_CODE| Name | CL_TAKEN_DATE | CL_BALANCE | 01-OCT-12 | 02-OCT-12 | 03-OCT-12
100001.............John...........02-OCT-12...............6
100002.............chris...........01-OCT-12...............4
Based on user input, that is, if user need the report from 01-OCT-12 TO 03-OCT-12, i need to add that dates as column in my table, like 01-OCT-12 | 02-OCT-12 | 03-OCT-12....
below is my code
create or replace
procedure MONTHLY_LVE_NEW_REPORT_demo
L_BUSINESS_UNIT IN SSHRMS_LEAVE_REQUEST_TRN.BUSINESS_UNIT%TYPE,
--L_LEAVE_TYPE_CODE IN SSHRMS_LEAVE_REQUEST_TRN.LEAVE_TYPE_CODE%TYPE,
L_DEPARTMENT_CODE IN VARCHAR2,
--L_MONTH IN SSHRMS_LEAVE_REQUEST_TRN.LVE_FROM_DATE%TYPE,
L_FROM_DATE IN SSHRMS_LEAVE_REQUEST_TRN.LVE_FROM_DATE%TYPE,
L_TO_DATE in SSHRMS_LEAVE_REQUEST_TRN.LVE_TO_DATE%type,
MONTHRPT_CURSOR OUT SYS_REFCURSOR
AS
O_MONTHRPT_CURSOR_RPT clob;
v_return_msg clob;
BEGIN
IF (L_BUSINESS_UNIT IS NOT NULL
AND L_FROM_DATE IS NOT NULL
and L_TO_DATE is not null
-- AND L_DEPARTMENT_CODE IS NOT NULL
THEN
OPEN MONTHRPT_CURSOR FOR
select EMPLOYEE_CODE, EMPLOYEE_NAME AS NAME, DEPARTMENT_CODE AS DEPARTMENT,DEPARTMENT_DESC, CREATED_DATE,
NVL(WM_CONCAT(CL_RANGE),'') as CL_TAKEN_DATE,
case when NVL(SUM(CL2),0)<0 then 0 else (NVL(SUM(CL2),0)) end as CL_BALANCE,
from
SELECT DISTINCT a.employee_code,
a.EMPLOYEE_FIRST_NAME || ' ' || a.EMPLOYEE_LAST_NAME as EMPLOYEE_NAME,
a.DEPARTMENT_CODE,
a.DEPARTMENT_DESC,
B.LEAVE_TYPE_CODE,
B.LVE_UNITS_APPLIED,
B.CREATED_DATE as CREATED_DATE,
DECODE(b.leave_type_code,'CL',SSHRMS_LVE_BUSINESSDAY(L_BUSINESS_UNIT,to_char(b.lve_from_date,'mm/dd/yyyy'), to_char(b.lve_to_date,'mm/dd/yyyy'))) CL_RANGE,
DECODE(B.LEAVE_TYPE_CODE,'CL',B.LVE_UNITS_APPLIED)CL1,
b.status
from SSHRMS_EMPLOYEE_DATA a
join
SSHRMS_LEAVE_BALANCE C
on a.EMPLOYEE_CODE = C.EMPLOYEE_CODE
and C.STATUS = 'Y'
left join
SSHRMS_LEAVE_REQUEST_TRN B
on
B.EMPLOYEE_CODE=C.EMPLOYEE_CODE
and c.EMPLOYEE_CODE = b.EMPLOYEE_CODE
and B.LEAVE_TYPE_CODE = C.LEAVE_TYPE_CODE
and B.STATUS in ('A','P','C')
and (B.LVE_FROM_DATE >= TO_DATE(L_FROM_DATE, 'DD/MON/RRRR')
and B.LVE_TO_DATE <= TO_DATE(L_TO_DATE, 'DD/MON/RRRR'))
join
SSHRMS_LEAVE_REQUEST_TRN D
on a.EMPLOYEE_CODE = D.EMPLOYEE_CODE
and D.LEAVE_TYPE_CODE in ('CL')
AND D.LEAVE_TYPE_CODE IS NOT NULL
group by EMPLOYEE_CODE, EMPLOYEE_NAME, DEPARTMENT_CODE, DEPARTMENT_DESC, CREATED_DATE
else
v_return_msg:='Field should not be empty';
end if;
END;
my code actual output
EMPLOYEE_CODE| Name | CL_TAKEN_DATE | CL_BALANCE
100001....................John............02-OCT-12.................6
100001....................chris...........01-OCT-12.................4
how to add column dynamically based on from_date to to_date?
Thanks and Regards,
Chris Jerome.You cannot add columns dynamically. But you can define a maximum number of numbers and then hide unused columns in your form useing SET_ITEM_PROPERTY(..,VISIBLE, PROPERTY_FALSE);
-
Redirect to different pages based on user input value
Hello,
Anyone please help.
I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
if user inputs empno whose job is 'MANAGER' then redirect to page 10
For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
declare
v_job varchar2(20);
begin
select job into v_job from emp where empno = :P9_EMPNO_R;
if v_job = 'ANALYST' then
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
end if;
if v_job = 'MANAGER' then
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
end if;
end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
Thanks,
Ortonorton607 wrote:
Hello,
Anyone please help.
I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
if user inputs empno whose job is 'MANAGER' then redirect to page 10
For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
declare
v_job varchar2(20);
begin
select job into v_job from emp where empno = :P9_EMPNO_R;
if v_job = 'ANALYST' then
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
end if;
if v_job = 'MANAGER' then
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
end if;
end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
Thanks,
OrtonI have a similar scenario in my application and this is how I handle it.
1. Create a page item on the page, say Px_PAGE_NUM
2. Create a "On Submit - After Computations and Validations" page process to set the above page item. In your case, you can use the same logic that you have already in place (except the call to OWA_UTIL.REDIRECT_URL) :
declare
v_job varchar2(20);
begin
select job into v_job from emp where empno = :P9_EMPNO_R;
if v_job = 'ANALYST' then
:Px_PAGE_NUM := '1';
end if;
if v_job = 'MANAGER' then
:Px_PAGE_NUM := '10';
end if;
end;3. Create a "On Submit: After processing" branch. Specify the "Target Type" as "Page in the application" and "Page Number" as &Px_PAGE_NUM. (with the dot).
I hope the above helps.
BTW, the following thread in the forum related to OWA_UTIL.REDIRECT_URL might help:
issue OWA_UTIL.REDIRECT_URL with APEX 4.1.1 -
Displaying columns based on User Input
Hi,
I have a following requirement :
I have four columns in a report : Performance Indicator ,Target (XTD) , Actual (XTD),Indicator(Traffic Lights)
Based on the prompt, which contains column named as "Review Frequency" having values as 1. Monthly 2. Quaterly 3. Yearly.
When User select "Monthly" in pormpt I want to see MTD in Actual and Target column and Indicator depending on these columns.
When User select "Quaterly" in pormpt I want to see QTD in Actual and Target column and Indicator depending on these columns.
Can anybody tell me how can we achieve this?
I think I can achieve this with guided navigation but for that I have to create 3 reports.
Can anybody have any better idea to create just one report and based on user input I can show/hide columns in a single report?
This is mainly related to Balanced ScoreCard.
Thanks in advance
Regards,
Vikasyou have seperate columns for monthly, quarterly, and yearly, right?
In the prompt, save the "Review Frequency" as a Presentation Variable "abc";
In the request, you add actual (MTD) column, edit the formula, use something like:
CASE
WHEN @{abc}='Monthly' THEN "- SalesFacts"."actual (MTD)"
WHEN @{abc}='Quarterly' THEN "- SalesFacts"."actual (QTD)"
ELSE "- SalesFacts"."actual (YTD)"
END
then do the same thing for target column. -
Hello,
Is there a way that I can get Discoverer to run different queries based on user input? In other words, I have two parameters "A" and "B". If the user enters a value for "A", execute QUERY1. If the user enters a value for "B", execute QUERY2. If both parameters are left blank, execute QUERY3. If the user enters values for "A" and "B", execute QUERY4.
I'm fairly new to Discoverer so any help that I can receive on this matter will be greatly appreciated.
Thank YouDenes Kubicek wrote:
I think this example shows something similar:
https://apex.oracle.com/pls/apex/f?p=31517:91
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
https://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
-------------------------------------------------------------------I see there is executing stored queries example, and text area showing executed one, but not quite understand how to sent sql-query directly from text input, based on your example :/ -
Excel Macro to Delete rows based on user input
I need help creating a macro that will delete rows in a spreadsheet based on user input. Have little to no experience writing macros.
Rows are distinguished based on codes in column B, so if the user types "6657", the row with code 6657 should be deleted. Any help would be much appreciatedHi,
Please try the macro:
Sub Sample()
Dim Ret As Long
Ret = Application.InputBox(Prompt:="Please enter a row number", Type:=1)
If Ret = False Then Exit Sub
With ActiveSheet
.Rows(Ret).Delete Shift:=xlUp
End With
End Sub
If you have further question about the VBA code, please post your question to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
George Zhao
TechNet Community Support -
Displaying alert message based on user input on input param screen
Hi,
Based on user input I wish to display an alert popup on my report. I
have provided the user 2 dropdowns called sortasc and sortdesc with all
the column names used in the report to simulate dynamic sorting.This is
because we do not have dynamic sorting in CR XI R2. When the user
selects same column name in both sortasc and sortdesc then the sort
type which has priority in the record sort expert is executed. This is fine but we want an alert
or message popup displayed so as to prevent user from selecting same
column names.
I tried adding an alert with the following code:
if {?sortasc} = {?sortdesc} then true else false
So far I have not been prompted with any alert message box.
Let me know if there is any other option.Hi Shalu,
I have created a alert and it is working fine, please follow the steps
Create a new Alert using two static parameters and give the condition for message like :
if {?Myworld} = {?Myworld1} Then
'You have entered a correct word'
else
'This is not a correct word'
Then create a condition like :
{?Myworld} = {?Myworld1} or {?Myworld} <> {?Myworld1}
Also check the check box Enabled and save the alert. Now it will popup if the myworld is equal to myworld1 or myworld is not equal to myworld1.
Hope this will help you
Thanks,
Sastry -
Generate charts based on user input
Hello!
My goal is to create an application in which a user would enter information (specifically in the form of numbers and financials). The final output would create a page / document that shows summary of the data and also manipulates the data into bar and pie charts. (We are trying to create side by side comparison charts based on user input.)
I have a subscription to the Creative Cloud, so I have access to a large % of Adobe products. Do you have any suggestions on what application I should use for this project? The final output could be PDF or Web based.
Thank you!
BethanyHi Bethany,
You may check out Adobe FormsCentral at https://www.acrobat.com/formscentral/en/home.html and see if that's what you need. You can create forms using Adobe FormsCentral to collect user input and user responses will be displayed in charts.
Thanks,
Wenlan -
Group Policy - Computer Startup Scripts - Add/Set Default printer
Good Morning.
Let's say we have 2 offices, A and B, and only 1 user. The user is using Roaming Profiles. Each office has its own printer.
What I am trying to do, is make a Startup script that is specific to the COMPUTER being logged into so when any user logs into that computer, they get the printer in that office defined and set as default.
I am able to do this successfully with my script but ONLY if i have the script be on the USER side of GP (i.e. in the Logon script section)
That is great that that is working however, when my user goes to Office B, they still get mapped to Office A's printer if I use that method.
So I figured I could just modify my GP and run the same script from the STARTUP section of the computer, rather than the LOGON section of the user. It does not work.
Here is my script:
Set WRFCUNetwork = CreateObject("Wscript.Network")
PrinterPath = "\\fileserver\MAINTELLER"
PrinterDriver = "PrinterDriver"
WRFCUNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WRFCUNetwork.SetDefaultPrinter "\\fileserver\MAINTELLER"
This is where I Have the script placed:
Computer Configuration -> Windows Settings -> Scripts(Startup/Shutdown)
Once i'm in there, I double click Startup, click Add, and select my script which is named:
MainPrinterSetup.vbs
I have this GP applied to ONE OU, and that OU has ONE computer in it (my test computer)
I login with a brand new user called "testuser" (creative, huh?) and basically nothing happens
except they log in and have some Microsoft Document Image Writer printer set as default (which by the way sure does slow the PC down to the point of it almost being broke if anyone actually tries to print to that by accident)
No Main Teller Printer, no anything.
The strangest part about this is, if i apply this script to the user LOGON scripts, it works fine, the printer is there, and is set as default. (but see above why that wont work for my situation)
So obviously the script works fine, but I guess i'm missing something when it comes to applying GP's to Computers rather than Users.
Can anyone shed some light as to why the script is not running (i'm guessing the script isn't even attempting to run, rather than failing, but i have no way to know that)
Thank you in advance!!
Derek Conlon
Network Administrator
WRFCU
EDIT: Here are the PC's info that i'm working on:
Server: Windows Server 2003 Standard Edition (where my GP's are created and managed with AD)
Target PC: Windows XP Professional SP3
EDIT #2: I manually navigated to the Script file after logging in and "opened" it and it added and set the default printer no problem. the issue is definately with the script running at startup.I wanted to clarify a few things:
1. While it is true that printer connections are usually per user, it is definitely possible to create "global printers". There are a number of ways to do this, but two methods that come to mind are using:
a. "Rundll32 printui.dll,PrintUIEntry" option with the "/ga" switch. The "/ga" switch is the key here since it allows you to deploy printers "per machine" instead of "per user". More information
about this is available at:
http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm
http://technet.microsoft.com/en-us/library/ee624057%28WS.10%29.aspx
http://www.computerperformance.co.uk/Logon/logon_printer_computer.htm
http://www.robvanderwoude.com/2kprintcontrol.php
b. The Print Management console that is available in Windows 2003 R2 and higher can help you deploy printers "per machine" in addition to "per user". More information about this is available at:
http://www.czsolution.com/print-management/print-management/print-management-console.htm#DeployingPrintersByGroupPolicy
http://technet.microsoft.com/en-us/library/cc753109%28WS.10%29.aspx
2. As Guy mentioned, Group Policy Preferences can help set the default printer. But there is another way to accomplish this. The problem with the computer startup portion is that it runs before the user logs in. And applying this script
in the login script section would not work per computer unless you used loopback processing. So another way to do this is to place a script that sets the default printer into the "All Users" startup folder. Items in the "All Users"
startup folder run for any user that logs into the computer, but it runs in the user's context. So, this script would effectively set the default printer on a "per machine" basis. The script method is a cruder way to approach the problem,
but it will help get the job done. Here are some resources on setting the default printer via script:
http://www.intelliadmin.com/index.php/2007/08/set-default-printer-from-a-script
http://www.computerperformance.co.uk/ezine/ezine17.htm -
Pass variable and set default value based on user's group
Hello
I'm using SharePoint 2010 and SQL 2012. I need to send a variable to the page and based on its value, set default value for a drop down list and send it to other web part to filter the data. Is it possible for certain users to send that value as a default
and limit user to see only this value in the text field or drop down list; for others - to allow to see the drop down list, but also set the default value for that list?
The main page was designed in SharePoint designer, using web parts (aspx page). I had setup a connection to Active Directory and already have the code to get user's groups and based on their group, I have that variable pulled into the web page for further
use. But I don't know how to pass that value as a default value to the web part (currently using SharePoint Filter web part). When I tried to set a default value for the web part - it automatically puts the quotation marks around the name of the variable
and shows it as a text instead of showing the value of the field.
Thank you!
P.s. I have limited knowledge of SharePoint and need guidance (links, examples, recommendations)!
Alla SandersThank you for your response. I'll try to give you more details. On PageA I check user's groups and based on the group, assign the value and pass it to the next page (no input from the user, all done behind the scene and user is redirected to PageB).
On the next page I read that value and would like to send it to the SharePoint List Filter Web as a default value, as well as send it to another web part that displays the list from SQL, filtered using that default value. Ideally, if the user is from Group
A, I'd like for them to have only one value in that drop down list; if user is from Group B - give him drop down list with 40 items to choose from. Below there is a part of the code and variable fnum has the value from PageA (if I print the value on the screen
- I do see that it has correct value, so the code that gets groups from Active directory works correctly). If I assign fnum as a default value of the list, it shows "fnum" instead of the value of variable fnum. I connect to SQL database, using external
content - so the other list that I'm filtering based on the value in that drop down list - is XSLT Data View Web part. I also have 2 more filters on that page, that user will have full access to and based on their input, it is also sent to the XSLT web part
to filter out more data. Since one of the filters is the date and I am filtering data starting from the date that user chooses - XSLT is the only web part that I was able to make it work with.
I looked at the link you provided (thank you). It is using Content Query Web part. Will it work with external content, as well as accepting multiple filtering, including custom starting date? I appreciate your help!
<%
string fnum = Request.QueryString["field1"];
%><table cellpadding="4" cellspacing="0" border="0" style="height: 1000px">
<tr>
<td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="2" valign="top" style="height: 101px">
<WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate>
<WpNs0:SpListFilterWebPart runat="server" FilterMainControlWidthPixels="0" RequireSelection="False" ExportMode="All" PartImageLarge="/_layouts/images/wp_Filter.gif" AllowHide="False" ShowEmptyValue="True" MissingAssembly="Cannot import this Web Part." AllowClose="False" ID="g_1ccc4bca_3ba1_480b_b726_adfdb1e9e02d" IsIncludedFilter="" DetailLink="" AllowRemove="False" HelpMode="Modeless" AllowEdit="True" ValueFieldGuid="fa564e0f-0c70-4ab9-b863-0177e6ddd247" IsIncluded="True" Description="Filter the contents of web parts by using a list of values from a Office SharePoint Server list." FrameState="Normal" Dir="Default" AllowZoneChange="True" AllowMinimize="False" DefaultValue="fnum" Title="Facilities List Filter" PartOrder="2" ViewGuid="2da5d8db-6b55-4403-80a8-111e42049f8b" FrameType="None" CatalogIconImageUrl="/_layouts/images/wp_Filter.gif" FilterName="Facilities List Filter" HelpLink="" PartImageSmall="/_layouts/images/wp_Filter.gif" AllowConnect="True" DescriptionFieldGuid="2d97730a-cd0d-4cb9-8b55-424951201081" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" TitleIconImageUrl="/_layouts/images/wp_Filter.gif" ChromeType="None" SuppressWebPartChrome="False" IsVisible="True" ListUrl="/Lists/FacilitiesList" AllowMultipleSelections="False" ZoneID="Header" __MarkupType="vsattributemarkup" __WebPartId="{768E2035-0461-4A09-8DDD-CA7020C2B23D}" WebPart="true" Height="" Width="615px"></WpNs0:SpListFilterWebPart>
Alla Sanders
Maybe you are looking for
-
Cannot click on (Sign in), (Ask this) and such buttons
Only my dear browser (firefox) having a problem with clicking on (sign in) buttons or such which forces me to restart it so many times until it gets fixed, but now even restarting doesn't help so I am sending this from chrome cause i wasn't even able
-
How do I get a link from YouTube to play (full size) in Keynote?
-
Data element for mm.yyyy
Hello Experts, Is there any data element for a field with the format mm.yyyy . I need to place this field in the selection screen and i want to have an F4 help too. It will be better if i am provided with the database table name too. Please help. Us
-
IPhone won´t restore! *URGENT PLS HELP*
Hi! I really need your help guys. I am abroad and can not get my iPhone to repair for a long time, so I am hoping you can help me solving this problem here! My iPhone started acting up this morning: when I turned it on, it showed me the connect to iT
-
I have a problem trying to see my photos after taking them. Can take them using the camera. Can preview the photos but when i want to see them, "goto photos" option opens up a entirely blank screen. Trying to access it via the menu opens up a blank s