HI All,
How to Change the Screen Saver Settings to Mystify in Windows 7 using vbscript?
Thanks
Divakar
HI All,
How to Change the Screen Saver Settings to Mystify in Windows 7 using vbscript?
Thanks
Divakar
Hi
I am attempting to add new users in bulk to AD using the below PowerShell script:
Import-Module ActiveDirectory
Import-Csv "C:\users1.csv" | New-ADuser -PasswordNeverExpires $true -AccountPassword (ConvertTo-SecureString "Pass1234" -AsPlainText -Force) -Enabled $True -Server <AD-servername>
Note: <AD-servername> is replaced by the actual name of the Domain Controller
The contents of the CSV are (lines 1 & 2 only are provided below):
Name,Type,SamAccountName,GivenName,Surname,DisplayName,Description,EmailAddress,Company,StreetAddress,State,PostalCode,City,Country,Organization,Path,UserPrincipalNameWhen executing the script I get the following error:
New-ADuser : The server is unwilling to process the request
At C:\Users.ps1:2 char:29
+ Import-Csv "C:\users ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=Djohn...et,DC=domain,DC=net:String) [New-ADUser], ADException
+ FullyQualifiedErrorId : The server is unwilling to process the request,Microsoft.ActiveDirectory.Management.Commands.NewADUser
After investigation on different forums (e.g: http://www.manageengine.com/products/ad-manager/help/misc/troubleshooting_tips.html#admgmt_usermodificatio_80072035 or http://social.technet.microsoft.com/Forums/scriptcenter/en-US/ae10b881-ae5b-4382-b033-47174e5acd8a/error-with-newaduser-command?forum=winserverpowershell) I have verified:
Name : DOE John
Type : User
SamAccountName : DJohn
GivenName : John
Surname : DOE
DisplayName : John DOE
Description : Sales Supervisor
EmailAddress : DJohn@domain.com
Company : Corp Europe
StreetAddress : 16 Street Add
State : MA
PostalCode : 1234
City : Boston
Country : USA
Organization : Corp
Path : OU=Users,OU=warehouse01 - boston - ma,OU=Massachussetts,DC=domain,DC=net
UserPrincipalName : Djohn@domain.com
PS: the OU Users is the child OU of warehouse01 - boston - ma which is itself a child of Massachussetts
PPS: Domain.com is the external dns domain name. Domain.net is the local dns domain name. All our users have this format.
==
What is this error? what am i doing wrong?
Thanks,
Karim
how can i find users in the domain that have not changed their passwords in the last 180days?
Hi
I have a text file with the list of servers and it is called servers.txt and I want to run the below command on all the drives on all the servers in that text file.
icacls folder1 /T /Grant "domain\user1:F"
Can you please give me a sample Powershell script to do it
thanks
I have a script working fine with msi but it doesn't work with exe installer. Need professional advise and help
The first part of script create a folder and unzip the zipped folder which contain setup.exe
But the rest part of script running 3 installers didn't work , just hanging. If I manually run each installer at PS console, it is ok but I want them to run in sequence , silently and remotely with GPO that has already enabled PSRemoting. GPO also set up to load the files (unzipped)in local C:\test folder:
# install msi and exe InstallerHi,
I am using a powershell script to install printer drivers from our print server. I am getting a error.
Sript :-
(New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\ptprint\pg1-b")
(New-Object -ComObject WScript.Network).SetDefaultPrinter('\\ptprint\pg1-b')
PTPRINT is our print server and pg1-b is printer shared name.
Error : -
Exception calling "AddWindowsPrinterConnection" with "1" argument(s): "The I/O operation has been aborted because of
either a thread exit or an application request. (Exception from HRESULT: 0x800703E3)"
At C:\Users\amitkumar_patil\Desktop\addprinter.ps1:4 char:1
+ (New-Object -ComObject WScript.Network).AddWindowsPrinterConnection("\\ptprint\p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
Exception calling "SetDefaultPrinter" with "1" argument(s): "There is no printer called "\\ptprint\pg1-b"."
At C:\Users\amitkumar_patil\Desktop\addprinter.ps1:10 char:1
+ (New-Object -ComObject WScript.Network).SetDefaultPrinter('\\ptprint\pg1-b')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
1. How to solve this ?
2. Is my way to install drivers is incorrect via power shell ?
I am curious to know if there is a way to get the username of the person that last changed a password (not necessarily his own).
For example: A regular user (say Gary) forgot his password and calls an admin whose username is ADM_JDOE and who has the right to reset passwords. How can I find out that the last password change was made by ADM_JDOE (or any other admin) and not by Gary?
Thanks,
SK
HI team,
I have a number of text file in a folder. each file gives information like hostname, OS, username, service pack etc. about individual machine. Example of one of the file
--------------------------------------------------------------------------------------
Hostname = desktop12456
OS = Windows 7
username = Joe B
--------------------------------------------------------------------------------------
I want to collect this information of all text files in excel sheet as
-------------------------------------------------------------
Hostname OS Username
desktop12346 Win 7 Joe B
laptop123456 win 8 mick s
.
---------------------------------------------------------------
Could please help give a idea which cmdlets can I use in writing a script ?
Dear,
I dont know what wrong with below script its not sccuessfully running
Option Explicit
Dim Obj, intRunError, strHomeFolder
Set Obj = wscript.createobject("wscript.shell")
strHomeFolder = "C:\Program Files\Temp\"
'intRunError = Obj.run ("%COMSPEC% /c Echo Y| cacls " & strHomeFolder & " /c /g users:M ", 2, True)
Obj.Run "icacls strHomeFolder /grant:r users:(OI)M"
Support@Mytechnet.me
Hi ,
I checked in the forum for that but did not find anything that can suits my issue.
I need to delete all the content of all users download folder every night .
I tried this %userprofile%\Downloads | where {($_.LastWriteTime).AddDays(1) -lt (get-date)} | remove-item -force -recurse
but it does not help.
Could you please help me or put me in the right direction .
Thanks
AGYL
Hi,
Is there a way to start a programm in the background?
I want to run a VirtualBox in Headless mode without opening any window.
With a C#.Net Programm I archived it like this:
myProcess.StartInfo.WorkingDirectory = @"C:\Program Files\Oracle\VirtualBox\"; myProcess.StartInfo.FileName = @"C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe"; myProcess.StartInfo.Arguments = string.Format("-s {0} -v on", args[0]); myProcess.StartInfo.CreateNoWindow = true; myProcess.StartInfo.UseShellExecute = false; myProcess.Start();
Now I would like to do it with powershell, as I thought that it also should work as it is also .Net able ...
I used the Start-Process comand but I does not work.
I tried some combinations like this:
$str = @("-s","vmBox","-v","on");
Start-Process -FilePath "C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" -ArgumentList $str -NoNewWindow -WorkingDirectory "C:\Program Files\Oracle\VirtualBox\"
But doing so, the program occupies the current powershell console and does not continue running when I close the terminal.
Is there a way to do so?
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3030821-allow-connecting-to-test-controller-using-differen <-- Vote for connecting with any user to Test Contrtoller
Hello everyone,
I use a powershell script (provided in the scripting guy blog and slightly modified by myself) to convert all .rtf files in a folder to pdf:
$wdFormatPDF = 17 $word = New-Object -ComObject word.application $word.visible = $false $folderpath = "C:\Users\xxx\Desktop\powershelltest\*" $fileTypes = "*.rtf" Get-ChildItem -path $folderpath -include $fileTypes | foreach-object ` { $path = ($_.fullname).substring(0,($_.FullName).lastindexOf(".")) $doc = $word.documents.open($_.fullname) $doc.saveas([ref] $path, [ref]$wdFormatPDF) $doc.close() } $word.Quit() Exit
My question is this: How do I specify options for the created PDF docs?
I need the created PDFs to have these characteristics:
Any hints and pointers are much appreciated as I am very inexperienced with powershell and could not find anything helpful in my searches.
Kind regards,
Tiaan
3am Eternal KLF 03:15 121 BMG C07.08 4 In The Morning Gwen Stefani 04:22 092 UMA HD1.10 4 Minutes Madonna ft J Timberlake 04:04 113 WAR HE3.05 5 6 7 8 Steps 03:24 000 BMG C48.03 5678 Steps 03:23 140 MUS H16.02 6 Of 1 Thing Craig David 03:15 116 WAR HE2.11 60 MPH New Order 03:51 125 WAR N57.11 7 Days Craig David 04:30 084 SHO N41.16 7 Things Miley Cyrus 03:29 107 EMI HE7.09 99 Luft Balloons Nena 03:58 095 WAR C27.10 99 Times Kate Voegele 03:27 112 UMA HG6.07 A Girl Like You Edwyn Collins 03:47 126 MDS R06.08 A Little Bit Pandora 03:35 132 UMA H23.01 A Little Less Conversation Elvis VS JXL 03:02 115 BMG H68.03 A Matter Of Trust Billy Joel 04:00 110 SON C59.11 A New Day Has Come Celine Dion 04:20 092 SON H65.20 A Woman Like You Mondo Rock 04:03 169 MUS R06.01 About You Now Sugababes 03:32 083 UMA HD5.08 Absolutely Everybody Vanessa Amorosi 03:52 124 TRA H40.06 Absolutely Fabulous Pet Shop Boys 03:45 132 EMI C15.02 Accidentally In Love Counting Crows 03:08 138 UMA H94.05 According To You Orianthi 03:18 066 UMA HG4.12 Achy Breaky Heart Billy Ray Cyrus 03:55 122 SON K11.02
Hey guys,
Im far from a Powershell guru and DEFINITELY not a SQL guy. With that being said, I'm trying to write a SQL table(2000) from a powershell script I have written. The script is using the FileSystemWatcher to write any new files that have a .tif file extension to a SQL table.
Obviously, This is not working. Here's my insert code.
$conn=New-ObjectSystem.Data.SqlClient.SqlConnection("Data Source=$SQLServerName; Initial Catalog=$SQLDatabase; Integrated Security=TRUE")
$conn.Open()
$insert_stmt="INSERT INTO in_cofa_pvs (in_item_key, in_lot_key, imgfileName, in_cofa_crtdt) VALUES ('$item','$lot','$name','$timestamp')"
$cmd=$conn.CreateCommand()
$cmd.CommandText=$insert_stmt
$cmd.ExecuteNonQuery()
$conn.Close()
I guess I have two questions. 1 is my code looking correct ? All the variables are defined in code prior. 2 can I even use Powershell to insert tables into SQL 2000 ? and 3 if question 1 is YES and 2 is YES what the heck am I doing wrong here ?
Is there a way that I can log my SQL attempts to see failure/success ? Obviously the first is going to be the case. But when I have it working I would like to see if either is true.
Thanks Guys
Rich
Rich Thompson
Hi,
Does anyone have a powershell script to list the products and classifications enabled on a wsus server?
Any assistance on this would be greatly appreciated.
Rick
Hi
I have created a script (With help from Google and some blogs :-)) that basically does the following:
1. Finds all mails with attachments
2. Saves the attachment
2.1 If it's a .ZIP file, the file is extracted
3. Prints the attachments
4. Moves the file to a subfolder called Archive (This part doesn't work
The steps from 1 to 3 is working fine, but the part about moving the items to the subfolder it fails.
I have tested it with my own username and it's working as expected, but when I run the script in production with the service account I have created with impersonation rights it fails.
As far as I can see the problem is that the service account can't get the ID of the subfolder. I use the following code:
$FolderName = "Archive" $oFolder = new-object Microsoft.Exchange.WebServices.Data.Folder($EWSService) $oFolder.DisplayName = $FolderName #Define Folder View really only want to return one object $fvFolderView = new-object Microsoft.Exchange.WebServices.Data.FolderView(1) #Define a Search folder that is going to do a search based on the DisplayName of the folder $SfSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName,$FolderName) #Do the Search $findFolderResults = $EWSService.FindFolders($InboxID,$SfSearchFilter,$fvFolderView) If ($findFolderResults.TotalCount -ne 0) { $DestID = $findFolderResults.ID $Email.Move($DestID) | Out-Null }
The "$findFolderResults.TotalCount" actually returns 1 if the folder is present but "$findFolderResults.ID" is empty, and therefor the "$Email.Move($DestID)" fails.
Any ideas?
Lasse
/Lasse