I tried using the sleep option not for 10 Sec but for a whole 60 sec. but nothing has changed. following is the troubleshooting steps i did to ensure where the problem is.
1. Create a Manual Group in AD by logging to DC and running a Action (WinNT Command) on Adaxes to add the created group to a remote computers local admin account.
THIS WORKED - So theres no issues in my WinNT command. and this rule out the ad sync issue you guys were saying. i ran the adaxes action as soon as i created the group. may have taken 5 Sec.
2. tried the script you posted with 60 Sec sleep time.
DID NOT WORK- group creation worked. because when the 60 Sec sleep was running i manually refreshed the AD in DC and i could see the group created there. and from the previous task i ensured that the WinNT command works and theres no AD sync issues for it to fail. im getting the same "Member does not exist" error i posted earlier.
This is really frustrating and with the above troubleshooting steps, i believe the problem is with the adaxes module. therefore i tried importing the AD module to get my code to work. but since you're running Adaxes in Powershell V2 i cant get the AD module to load. it gives me the following error.
The 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ActiveDirectory\ActiveDirectory.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that are not valid ('HelpInfoUri'), then try to import the module again.
Hoping if somebody could figure out whats wrong here. Or else let me know a way to load the ActiveDirectory module to get this to work.
We are planning to use adaxes for every customer domain we currently have. but if this task doesnt work, we may have to look for another way. but im sure you guys could help me in solving this.
Thanks alot guys.. :)