Script doesn't work when compiled to .exe
Posted: Fri Jan 05, 2018 8:58 am
Product, version and build: PowerShell Studio 2017, v5.4.145
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 1709
32 or 64 bit OS: 64 bit
I have a script that works great when I run it from within Studio but when I compile it into an .exe it fails.
Error initializing default drive: 'Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.'.
Get-ADUser : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.
At line:2533 char:21
+ ... l:ADUsers = Get-ADUser -Filter * -Properties DisplayName,Distinguishe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-ADUser], ADServerDownException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADUser
First line of script:
$CreateNewUser_Load={
#TODO: Initialize Form Controls here
Import-Module ActiveDirectory
$Global:ADUsers = Get-ADUser -Filter * -Properties DisplayName,DistinguishedName,HomeDirectory,Department,MemberOf,SAMAccountName,CN,EmailAddress -SearchBase "OU=<USEROU>,DC=<MYDOMAIN>,DC=com" | Where-Object { $_.DisplayName -notlike "zz*" }
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 1709
32 or 64 bit OS: 64 bit
I have a script that works great when I run it from within Studio but when I compile it into an .exe it fails.
Error initializing default drive: 'Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.'.
Get-ADUser : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.
At line:2533 char:21
+ ... l:ADUsers = Get-ADUser -Filter * -Properties DisplayName,Distinguishe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-ADUser], ADServerDownException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADUser
First line of script:
$CreateNewUser_Load={
#TODO: Initialize Form Controls here
Import-Module ActiveDirectory
$Global:ADUsers = Get-ADUser -Filter * -Properties DisplayName,DistinguishedName,HomeDirectory,Department,MemberOf,SAMAccountName,CN,EmailAddress -SearchBase "OU=<USEROU>,DC=<MYDOMAIN>,DC=com" | Where-Object { $_.DisplayName -notlike "zz*" }